diff --git a/mindspore/ccsrc/runtime/device/kernel_runtime.cc b/mindspore/ccsrc/runtime/device/kernel_runtime.cc index 02b1e0beb4..9aecae33e7 100644 --- a/mindspore/ccsrc/runtime/device/kernel_runtime.cc +++ b/mindspore/ccsrc/runtime/device/kernel_runtime.cc @@ -946,6 +946,19 @@ bool KernelRuntime::LaunchKernelMod(const session::KernelGraph &graph) { auto &kernel = kernels[i]; auto kernel_mod = AnfAlgo::GetKernelMod(kernel); MS_EXCEPTION_IF_NULL(kernel_mod); + + // Skip transpose kernel with "nop_op" attr which is not hidden or removed in PyNative infer scenario. Transpose + // kernel, which is not supposed to be executed, is generated in TransDataSplit to support specific Transdata. And + // hard code here should be removed after new Transdata programme is implemented in the foreseeable future. + if (AnfAlgo::HasNodeAttr("nop_op", kernel)) { + for (size_t idx = 0; idx < AnfAlgo::GetOutputTensorNum(kernel); idx += 1) { + auto real_input = AnfAlgo::GetRealInputIndex(kernel, idx); + auto device_address = AnfAlgo::GetPrevNodeMutableOutputAddr(kernel, real_input); + AnfAlgo::SetOutputAddr(device_address, idx, kernel.get()); + } + continue; + } + AddressPtrList kernel_inputs; AddressPtrList kernel_workspaces; AddressPtrList kernel_outputs;