提交 80c97e56 编写于 作者: Z Zhang Ting 提交者: Aurelius84

fix bias_attr's bug of conv and conv_transpose, test=develop (#20704)

上级 9e594823
...@@ -2801,7 +2801,10 @@ def conv2d(input, ...@@ -2801,7 +2801,10 @@ def conv2d(input,
"data_format": data_format, "data_format": data_format,
}) })
if data_format == 'NCHW':
pre_act = helper.append_bias_op(pre_bias, dim_start=1, dim_end=2) pre_act = helper.append_bias_op(pre_bias, dim_start=1, dim_end=2)
else:
pre_act = helper.append_bias_op(pre_bias, dim_start=3, dim_end=4)
return helper.append_activation(pre_act) return helper.append_activation(pre_act)
...@@ -3049,7 +3052,10 @@ def conv3d(input, ...@@ -3049,7 +3052,10 @@ def conv3d(input,
"data_format": data_format, "data_format": data_format,
}) })
if data_format == 'NCDHW':
pre_act = helper.append_bias_op(pre_bias, dim_start=1, dim_end=2) pre_act = helper.append_bias_op(pre_bias, dim_start=1, dim_end=2)
else:
pre_act = helper.append_bias_op(pre_bias, dim_start=4, dim_end=5)
return helper.append_activation(pre_act) return helper.append_activation(pre_act)
...@@ -5148,7 +5154,10 @@ def conv2d_transpose(input, ...@@ -5148,7 +5154,10 @@ def conv2d_transpose(input,
'data_format': data_format 'data_format': data_format
}) })
if data_format == 'NCHW':
pre_act = helper.append_bias_op(pre_bias, dim_start=1, dim_end=2) pre_act = helper.append_bias_op(pre_bias, dim_start=1, dim_end=2)
else:
pre_act = helper.append_bias_op(pre_bias, dim_start=3, dim_end=4)
out = helper.append_activation(pre_act) out = helper.append_activation(pre_act)
return out return out
...@@ -5423,7 +5432,10 @@ def conv3d_transpose(input, ...@@ -5423,7 +5432,10 @@ def conv3d_transpose(input,
'data_format': data_format 'data_format': data_format
}) })
if data_format == 'NCHW':
pre_act = helper.append_bias_op(pre_bias, dim_start=1, dim_end=2) pre_act = helper.append_bias_op(pre_bias, dim_start=1, dim_end=2)
else:
pre_act = helper.append_bias_op(pre_bias, dim_start=4, dim_end=5)
out = helper.append_activation(pre_act) out = helper.append_activation(pre_act)
return out return out
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册