@@ -34,7 +34,7 @@ at::Tensor convolution_impl(
34
34
const ideep::attr_t & attr) {
35
35
// TODO: the input will be actively converted to channels last format
36
36
// after the 5-D tensor supports channels last format.
37
- auto input_ = IS_CONTIGUOUS_ANY (input) ? input : input.contiguous ();
37
+ auto input_ = IS_CONTIGUOUS_ANY (input) ? input : input.contiguous (input. suggest_memory_format () );
38
38
const ideep::tensor mkldnn_input = at::native::itensor_view_from_dense (input_);
39
39
ideep::tensor mkldnn_weight = get_conv_prepacked_weight (mkldnn_input, weight, stride, padding, dilation, groups, attr);
40
40
auto kernel_size = mkldnn_weight.get_dims ();
@@ -105,7 +105,7 @@ void convolution_inplace_impl(
105
105
const ideep::attr_t & attr) {
106
106
// TODO: the input will be actively converted to channels last format
107
107
// after the 5-D tensor supports channels last format.
108
- auto input_ = IS_CONTIGUOUS_ANY (input) ? input : input.contiguous ();
108
+ auto input_ = IS_CONTIGUOUS_ANY (input) ? input : input.contiguous (input. suggest_memory_format () );
109
109
const ideep::tensor mkldnn_input = at::native::itensor_view_from_dense (input_);
110
110
ideep::tensor mkldnn_weight = get_conv_prepacked_weight (mkldnn_input, weight, stride, padding, dilation, groups, attr);
111
111
auto kernel_size = mkldnn_weight.get_dims ();
@@ -114,7 +114,7 @@ void convolution_inplace_impl(
114
114
calc_conv_output_size (input_size, kernel_size, padding, stride, dilation);
115
115
116
116
bool is_channels_last = input_.suggest_memory_format () == at::MemoryFormat::ChannelsLast;
117
- output = IS_CONTIGUOUS_ANY (output) ? output : output.contiguous ();
117
+ output = IS_CONTIGUOUS_ANY (output) ? output : output.contiguous (output. suggest_memory_format () );
118
118
output = output.to (input_.suggest_memory_format ());
119
119
ideep::tensor mkldnn_output = at::native::itensor_view_from_dense (output);
120
120
0 commit comments