diff --git a/paddle/fluid/operators/index_sample_op.cu b/paddle/fluid/operators/index_sample_op.cu index c8488eefb984f26559b32104be2fcc38068a5ae5..46dd91fed6cbc17487e7e49c14003953fc8772c2 100644 --- a/paddle/fluid/operators/index_sample_op.cu +++ b/paddle/fluid/operators/index_sample_op.cu @@ -55,7 +55,7 @@ __global__ void IndexSampleGrad(const IndexT* index, T* in_grad, platform::CudaAtomicAdd(&(in_grad[in_idx - index_i + sample_idx]), out_grad[sample_idx]); } else { - in_grad[in_idx - index_i + sample_idx] = out_grad[sample_idx]; + in_grad[in_idx - index_i + sample_idx] = out_grad[index_idx]; } } }