From 2136bd42910d759f54dec111779dd3f1d2218db6 Mon Sep 17 00:00:00 2001 From: niuliling123 <51102941+niuliling123@users.noreply.github.com> Date: Thu, 24 Feb 2022 10:23:26 +0800 Subject: [PATCH] Fix a bug in IndexKernel out-of-memory (#39867) --- paddle/fluid/operators/index_impl.cu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/paddle/fluid/operators/index_impl.cu.h b/paddle/fluid/operators/index_impl.cu.h index bae0d3f569..3d6a5e0ea8 100644 --- a/paddle/fluid/operators/index_impl.cu.h +++ b/paddle/fluid/operators/index_impl.cu.h @@ -45,7 +45,7 @@ __global__ void VectorizedIndexKernel(T *out, int numel, int main_offset, BLOCK_NUM_X * VecSize); } int num = numel - data_offset; - if (numel > 0) { + if (num > 0) { kps::InitWithDataIndex(&args[0], data_offset); kps::ElementwiseUnary(&result[0], &args[0], func); -- GitLab