diff --git a/paddle/fluid/operators/softmax_cudnn_op.cu.h b/paddle/fluid/operators/softmax_cudnn_op.cu.h index 1bdcc7193706a..5df8b651de8b3 100644 --- a/paddle/fluid/operators/softmax_cudnn_op.cu.h +++ b/paddle/fluid/operators/softmax_cudnn_op.cu.h @@ -206,7 +206,7 @@ struct SoftmaxBackwardFunctor { HOSTDEVICE inline SoftmaxBackwardFunctor(Tx sum) : sum(sum) {} HOSTDEVICE inline Ty operator()(const Tx& grad_out, const Tx& out) const { - return static_cast(grad_out - out * sum); + return static_cast(out * (grad_out - sum)); } private: