diff --git a/mindspore/ccsrc/runtime/device/kernel_runtime.cc b/mindspore/ccsrc/runtime/device/kernel_runtime.cc index 8937b805d12..d1e08cf336e 100644 --- a/mindspore/ccsrc/runtime/device/kernel_runtime.cc +++ b/mindspore/ccsrc/runtime/device/kernel_runtime.cc @@ -669,7 +669,10 @@ void KernelRuntime::AssignStaticMemoryInput(const session::KernelGraph &graph) { MS_LOG(INFO) << "It is not suggested to use a lonely weight parameter as the output of graph"; continue; } - DeviceAddressPtr device_address = GetInternalDeviceAddress(graph, item); + // If kernel has flag kFlagEnableZeroCopyInGraph, the internal parameter and the corresponding + // cnode cannot use the same device address. + DeviceAddressPtr device_address = + (graph.has_flag(kFlagEnableZeroCopyInGraph) ? nullptr : GetInternalDeviceAddress(graph, item)); GetDeviceAddress(item, shadow_backend_node_map, index, graph, &device_address); AnfAlgo::SetOutputAddr(device_address, index, item.get()); }