diff --git a/paddle/operators/bilinear_tensor_product_op.h b/paddle/operators/bilinear_tensor_product_op.h index ffa4f43a327418498c1f110504127e7d2878409d..ee9636e9fb7cbef84c494bf2f46b0fcb189717d6 100644 --- a/paddle/operators/bilinear_tensor_product_op.h +++ b/paddle/operators/bilinear_tensor_product_op.h @@ -63,6 +63,7 @@ class BilinearTensorProductKernel : public framework::OpKernel { math::gemm(ctx.device_context(), CblasNoTrans, CblasNoTrans, batch_size, y_dim, x_dim, 1, x->data(), weight_mat.data(), 0, left_mul.data()); + Eigen::array shape({{static_cast(out->dims()[0]), 1}}); output_col_vec.device(place) = (left_mul_mat * y_mat).sum(Eigen::DSizes(1)); } @@ -174,7 +175,7 @@ class BilinearTensorProductGradKernel : public framework::OpKernel { // Caculate the gradient of Input(Bias). if (d_bias) { d_bias->mutable_data(ctx.GetPlace()); - auto d_bias_mat = EigenMatrix::From(*d_bias); + auto d_bias_mat = framework::EigenVector::Flatten(*d_bias); d_bias_mat.device(place) = d_out_mat.sum(Eigen::DSizes(0)); } }