提交 e9cc5237 编写于 作者: M Megvii Engine Team

fix(mgb): format code

GitOrigin-RevId: 3e58539a2f7562c345343cfd5ed3918147b15210
上级 a07fbf79
......@@ -586,7 +586,7 @@ bool ConvolutionBackwardDataImpl::AlgoMatrixMul::is_preferred(
}
/* ===================== Matrix mul nchw44 algo ===================== */
namespace{
namespace {
void kern_matmul_nchw44(const NCBKernParam& param) {
bool is_xcorr = !param.filter_meta.should_flip;
UNPACK_CONV_F32_NCB_KERN_SIZES(param);
......@@ -628,7 +628,7 @@ void kern_matmul_nchw44(const NCBKernParam& param) {
}
TensorND B_, C_;
for (size_t n = 0; n < N; ++n) {
float*C_src, *C_dst;
float *C_src, *C_dst;
float* diff = const_cast<float*>(param.diff<float>() + n * param.inp_bs);
float* grad = param.grad<float>() + n * param.out_bs;
if (is1X1) {
......@@ -637,13 +637,13 @@ void kern_matmul_nchw44(const NCBKernParam& param) {
C_src = static_cast<float*>(bundle.get(0));
}
{
B_.layout = TensorLayout({OC/4, IH * IW, 4}, param.diff_type);
B_.layout = TensorLayout({OC / 4, IH * IW, 4}, param.diff_type);
B_.reset_ptr(static_cast<void*>(diff));
C_.layout = TensorLayout({IC / 4 * FH * FW, IH * IW, 4}, param.grad_type);
C_.reset_ptr(C_src);
Workspace workspace(
static_cast<dt_byte*>(bundle.get(1)), bundle.get_size(1));
auto matmul_opr =get_matmul_opr(param);
auto matmul_opr = get_matmul_opr(param);
matmul_opr->exec(A_dst, B_, C_, workspace);
}
......
......@@ -86,7 +86,7 @@ void col2img_stride_padding_nchw44(
if (h >= 0 && h < OH && w >= 0 && w < OW) {
float* dst_ptr = dst + (ic * OH * OW + h * OW + w) * 4;
GI_FLOAT32_t dst_data = GiLoadFloat32(dst_ptr);
GI_FLOAT32_t src_data = GiLoadFloat32(src+i);
GI_FLOAT32_t src_data = GiLoadFloat32(src + i);
GiStoreFloat32(dst_ptr, GiAddFloat32(dst_data, src_data));
}
i += 4;
......
......@@ -804,13 +804,11 @@ TEST_F(FALLBACK, BENCHMARK_CONVOLUTION_BACKWARD_DATA_NCHW44) {
.set_dtype(2, dtype::Float32{})
.set_times(RUN);
auto tnchw =
benchmarker_fallback.set_param(param)
.exec(TensorLayoutArray{filter, diff, grad});
auto tnchw = benchmarker_fallback.set_param(param).exec(
TensorLayoutArray{filter, diff, grad});
param.format = Param::Format::NCHW44;
auto tnchw44 =
benchmarker_fallback.set_param(param)
.exec(TensorLayoutArray{filter_nchw44, diff_nchw44, grad_nchw44});
auto tnchw44 = benchmarker_fallback.set_param(param).exec(
TensorLayoutArray{filter_nchw44, diff_nchw44, grad_nchw44});
size_t IC = ic;
size_t FH = fh;
size_t FW = fw;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册