Skip to content

Commit 4a1e884

Browse files
authored
[GCU] fix fused conv2d_add_act kernel (#1493)
1 parent 72fcaca commit 4a1e884

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

backends/gcu/kernels/fused_conv2d_add_act_kernel.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ void FusedConv2dAddActKernel(const Context& dev_ctx,
105105
auto new_bias = bias;
106106
auto bias_dims = common::vectorize(bias.dims());
107107
if (bias_dims.size() != 1) {
108-
if (std::count(bias_dims.begin(), bias_dims.end(), 1) !=
109-
bias_dims.size() - 1) {
108+
auto one_cnt = std::count(bias_dims.begin(), bias_dims.end(), 1);
109+
if ((one_cnt != 4) && (one_cnt != bias_dims.size() - 1)) {
110110
PADDLE_THROW(phi::errors::InvalidArgument(
111111
"Bias rank should be 1, unsupport bias dims: %s.",
112112
bias.dims().to_str().c_str()));

0 commit comments

Comments
 (0)