!13781 Ingnore transpose with nop_op attr in pynative infer

From: @HulkTang
Reviewed-by: @zhoufeng54,@chujinjin
Signed-off-by: @chujinjin
This commit is contained in:
mindspore-ci-bot 2021-03-23 14:08:10 +08:00 committed by Gitee
commit fa64151dd8
1 changed files with 13 additions and 0 deletions

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;