提交 ca8719a2 编写于 作者: Z zhaojiaying01

update the structure of the code of im2col.cpp

上级 c9be3171
...@@ -96,10 +96,6 @@ void ConvTransposeCompute(const ConvTransposeParam<CPU> &param) { ...@@ -96,10 +96,6 @@ void ConvTransposeCompute(const ConvTransposeParam<CPU> &param) {
math::matmul(filter_slice, true, in_slice, false, static_cast<P>(1.0), math::matmul(filter_slice, true, in_slice, false, static_cast<P>(1.0),
&col_matrix, static_cast<P>(0.0)); &col_matrix, static_cast<P>(0.0));
//初始化out_slice的值为0
float *tmp = out_slice.data<float>();
int numel = out_slice.numel();
memset(static_cast<void *>(tmp), 0, sizeof(float) * numel);
if (data_dim == 2U) { if (data_dim == 2U) {
col2im(col, dilations, strides, col2im(col, dilations, strides,
std::vector<int>{paddings[0], paddings[1], paddings[0], std::vector<int>{paddings[0], paddings[1], paddings[0],
......
...@@ -481,6 +481,7 @@ class Col2ImFunctor<ColFormat::kCFO, CPU, T> { ...@@ -481,6 +481,7 @@ class Col2ImFunctor<ColFormat::kCFO, CPU, T> {
T *im_data = im->data<T>(); T *im_data = im->data<T>();
const T *col_data = col.data<T>(); const T *col_data = col.data<T>();
memset(static_cast<void *>(im_data), 0, sizeof(T) * im->numel());
for (int c = 0; c < channels_col; ++c) { for (int c = 0; c < channels_col; ++c) {
int w_offset = c % filter_width; int w_offset = c % filter_width;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册