!18262 fixed ps data_parallel case result is error

Merge pull request !18262 from anancds/error
This commit is contained in:
i-robot 2021-06-12 09:45:34 +08:00 committed by Gitee
commit 7f731faa9b
1 changed files with 1 additions and 1 deletions

View File

@ -538,7 +538,7 @@ void GPUSession::UpdateOutputTensors(const VectorRef *outputs,
// address, to avoid that the device address context of tensor be rewritten in the next step or next loop.
// But one time memory application scenarios need to be skipped, because the memory is not allocated next step:
// 1. Non cnode 2. Communication kernel.
if (node->isa<CNode>() && !AnfAlgo::IsCommunicationOp(node)) {
if (node->isa<CNode>() && !AnfAlgo::IsCommunicationOp(node) && !ps::PSContext::instance()->is_ps_mode()) {
auto new_address = std::make_shared<device::gpu::GPUDeviceAddress>(nullptr, address->GetSize());
AnfAlgo::SetOutputAddr(new_address, output_index, node.get());
if (context::GraphKernelFlags::GetInstance().IsEnableGraphKernel()) {