From 951010a2d9272dc65a7f760cabfc704b0d6fb10f Mon Sep 17 00:00:00 2001 From: sneaxiy <32832641+sneaxiy@users.noreply.github.com> Date: Wed, 17 Aug 2022 10:03:59 +0800 Subject: [PATCH] Fix squared_l2_norm wrong stream bug (#45174) * fix squared_l2_norm bug * update buffer.h --- paddle/fluid/memory/buffer.h | 2 +- paddle/phi/kernels/funcs/squared_l2_norm.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/paddle/fluid/memory/buffer.h b/paddle/fluid/memory/buffer.h index e29ade18adc..8418970eade 100644 --- a/paddle/fluid/memory/buffer.h +++ b/paddle/fluid/memory/buffer.h @@ -50,7 +50,7 @@ class Buffer { allocation_ && allocation_->size() > 0 ? allocation_->ptr() : nullptr); } - size_t Size() const { return allocation_ ? 0 : allocation_->size(); } + size_t Size() const { return allocation_ ? allocation_->size() : 0; } platform::Place GetPlace() const { return place_; } diff --git a/paddle/phi/kernels/funcs/squared_l2_norm.h b/paddle/phi/kernels/funcs/squared_l2_norm.h index 21deecd5a74..13aa430c623 100644 --- a/paddle/phi/kernels/funcs/squared_l2_norm.h +++ b/paddle/phi/kernels/funcs/squared_l2_norm.h @@ -82,7 +82,8 @@ void SquaredL2Norm(const phi::GPUContext& ctx, y, numel, cub::Sum(), - static_cast(0))); + static_cast(0), + stream)); } } #endif -- GitLab