Skip to content

Commit 9cf6036

Browse files
authored
Merge pull request #5707 from qingqing01/cos_sim_op
Fix cos_sim_op in debug mode.
2 parents 55c2c73 + 24819df commit 9cf6036

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

paddle/operators/cos_sim_op.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class CosSimGradKernel : public framework::OpKernel<T> {
132132
// compute dy
133133
if (out_grad_y) {
134134
out_grad_y->mutable_data<T>(context.GetPlace());
135-
auto dy = EigenMatrix<T>::Reshape(*out_grad_y, 1);
135+
auto dy = EigenVector<T>::Flatten(*out_grad_y);
136136
auto grad = x / norm_prod_bcast - z_bcast * y_bcast / y_snorm_bcast;
137137
dy.device(place) = (dz_bcast * grad).sum(Eigen::array<int, 1>({{0}}));
138138
}

0 commit comments

Comments
 (0)