提交 111ca78b 编写于 作者: J Jiaying Zhao 提交者: GitHub

fix cpu conv_add and conv_add_relu (#1654)

* fix cpu conv_add and conv_add_relu

* fix cpu conv_add and conv_add_relu
上级 66ad725e
...@@ -52,7 +52,13 @@ void ConvAddKernel<CPU, float>::Compute(const FusionConvAddParam<CPU> &param) { ...@@ -52,7 +52,13 @@ void ConvAddKernel<CPU, float>::Compute(const FusionConvAddParam<CPU> &param) {
PADDLE_MOBILE_THROW_EXCEPTION("Invalid convolution execute mode %d", PADDLE_MOBILE_THROW_EXCEPTION("Invalid convolution execute mode %d",
param.ExecMode()); param.ExecMode());
} }
math::AddChannelWise<IDENTITY>(param.Output(), param.Bias(), param.Output()); if (param.Bias()->dims() == param.Output()->dims()) {
math::AddElememtWise<IDENTITY>(param.Output(), param.Bias(), param.Axis(),
param.Output());
} else {
math::AddChannelWise<IDENTITY>(param.Output(), param.Bias(),
param.Output());
}
} }
template class ConvAddKernel<CPU, float>; template class ConvAddKernel<CPU, float>;
......
...@@ -53,7 +53,12 @@ void ConvAddReluKernel<CPU, float>::Compute( ...@@ -53,7 +53,12 @@ void ConvAddReluKernel<CPU, float>::Compute(
PADDLE_MOBILE_THROW_EXCEPTION("Invalid convolution execute mode %d", PADDLE_MOBILE_THROW_EXCEPTION("Invalid convolution execute mode %d",
param.ExecMode()); param.ExecMode());
} }
math::AddChannelWise<RELU>(param.Output(), param.Bias(), param.Output()); if (param.Bias()->dims() == param.Output()->dims()) {
math::AddElememtWise<RELU>(param.Output(), param.Bias(), param.Axis(),
param.Output());
} else {
math::AddChannelWise<RELU>(param.Output(), param.Bias(), param.Output());
}
} }
template class ConvAddReluKernel<CPU, float>; template class ConvAddReluKernel<CPU, float>;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册