File tree Expand file tree Collapse file tree 1 file changed +2
-1
lines changed
paddle/fluid/operators/math Expand file tree Collapse file tree 1 file changed +2
-1
lines changed Original file line number Diff line number Diff line change @@ -54,14 +54,15 @@ class Im2ColFunctor<paddle::operators::math::ColFormat::kCFO,
54
54
if (stride[0 ] == 1 && stride[1 ] == 1 && dilation[0 ] == 1 &&
55
55
dilation[1 ] == 1 && padding[0 ] == 0 && padding[1 ] == 0 ) {
56
56
int col_matrix_width = output_width * output_height;
57
+ size_t copy_size = sizeof (T) * output_width;
57
58
for (int oh = 0 ; oh < output_height; ++oh) {
58
59
const T* im_data_start = im_data + oh * im_width;
59
60
T* dst_data = col_data + oh * output_width;
60
61
for (int ic = 0 ; ic < im_channels; ++ic) {
61
62
const T* src_data = im_data_start + ic * im_height * im_width;
62
63
for (int kh = 0 ; kh < filter_height; ++kh) {
63
64
for (int kw = 0 ; kw < filter_width; ++kw) {
64
- std::memcpy (dst_data, src_data + kw, sizeof (T) * output_width );
65
+ std::memcpy (dst_data, src_data + kw, copy_size );
65
66
dst_data = dst_data + col_matrix_width;
66
67
}
67
68
src_data = src_data + im_width;
You can’t perform that action at this time.
0 commit comments