提交 40fba4aa 编写于 作者: Q qingqing01 提交者: GitHub

Merge pull request #4115 from Canpio/fix_brace_error

Fix Clang compile error
......@@ -56,7 +56,7 @@ class CosSimKernel : public framework::OpKernel {
x_norm.device(place) = x.square().sum(row_along).sqrt();
y_norm.device(place) = y.square().sum(row_along).sqrt();
if (rows_x == rows_y) {
auto xy = (x * y).sum(Eigen::array<int, 1>({1}));
auto xy = (x * y).sum(Eigen::array<int, 1>({{1}}));
z.device(place) = xy / x_norm / y_norm;
} else {
Eigen::DSizes<int, 2> bcast(rows_x, 1);
......@@ -134,7 +134,7 @@ class CosSimGradKernel : public framework::OpKernel {
out_grad_y->mutable_data<T>(context.GetPlace());
auto dy = EigenMatrix<T>::Reshape(*out_grad_y, 1);
auto grad = x / norm_prod_bcast - z_bcast * y_bcast / y_snorm_bcast;
dy.device(place) = (dz_bcast * grad).sum(Eigen::array<int, 1>({0}));
dy.device(place) = (dz_bcast * grad).sum(Eigen::array<int, 1>({{0}}));
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册