Browse Source

Ingnore transpose with nop_op attr in pynative infer

pull/13781/head
tanghuikang 4 years ago
parent
commit
e8382c6187
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      mindspore/ccsrc/runtime/device/kernel_runtime.cc

+ 13
- 0
mindspore/ccsrc/runtime/device/kernel_runtime.cc View File

@@ -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;


Loading…
Cancel
Save