未验证 提交 d9e7cf8b 编写于 作者: R Ruilong Liu 提交者: GitHub

Merge pull request #585 from Eclipsess/develop

fix #584 add basic with group
......@@ -104,7 +104,7 @@ void ConvAddBNReluBasic(const FusionConvAddBNReluParam &param) {
math::matmulWithBn<float>(
filter_slice, false, col_matrix, false, static_cast<float>(1),
&out_slice, static_cast<float>(0), true, &new_scale, &new_bias);
&out_slice, static_cast<float>(0), true, &new_scale, &new_bias, g);
}
}
}
......
......@@ -101,10 +101,9 @@ void DWConvBNReluBasic(const FusionDWConvBNReluParam &param) {
// gemm
Tensor out_slice = out_batch.Slice(g * out_step, (g + 1) * out_step);
Tensor filter_slice = filter.Slice(g * out_step, (g + 1) * out_step);
std::cout << "***************" << std::endl;
math::matmulWithBn<float>(
filter_slice, false, col_matrix, false, static_cast<float>(1),
&out_slice, static_cast<float>(0), false, &new_scale, &new_bias);
&out_slice, static_cast<float>(0), true, &new_scale, &new_bias, g);
}
}
}
......
......@@ -50,7 +50,7 @@ void matmulWithBn<float>(const framework::Tensor &matrix_a, bool trans_a,
const framework::Tensor &matrix_b, bool trans_b,
float alpha, framework::Tensor *matrix_out, float beta,
bool relu, framework::Tensor *new_scale,
framework::Tensor *new_bias) {
framework::Tensor *new_bias, int group) {
auto dim_a = matrix_a.dims();
auto dim_b = matrix_b.dims();
auto dim_out = matrix_out->dims();
......@@ -71,7 +71,8 @@ void matmulWithBn<float>(const framework::Tensor &matrix_a, bool trans_a,
SgemmWithBn(M, N, K, alpha, matrix_a.data<float>(), K, matrix_b.data<float>(),
N, beta, matrix_out->data<float>(), N, relu,
new_scale->data<float>(), new_bias->data<float>());
new_scale->data<float>() + group,
new_bias->data<float>() + group);
}
} // namespace math
......
......@@ -31,7 +31,8 @@ template <typename T>
void matmulWithBn(const framework::Tensor &matrix_a, bool trans_a,
const framework::Tensor &matrix_b, bool trans_b, T alpha,
framework::Tensor *matrix_out, T beta, bool relu,
framework::Tensor *new_scale, framework::Tensor *new_bias);
framework::Tensor *new_scale, framework::Tensor *new_bias,
int group);
} // namespace math
} // namespace operators
} // namespace paddle_mobile
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册