pytorch_v1.6 训练或检测时,报UserWarning: Mixed memory format inputs detected while calling the operator

在使用pytorch_v1.6训练或检测时,model报如下警告:

UserWarning: Mixed memory format inputs detected while calling the operator. The operator will output contiguous tensor even if some of the inputs are in channels_last format. (Triggered internally at  /pytorch/aten/src/ATen/native/TensorIterator.cpp:918.)

推测原因:由于pytorch  1.6版本的bug引起;因为同样的model,在1.7版本上,无此警告信息。

解决方法:在对应的警告代码后面加上“.contiguous()”即可。

你可能感兴趣的:(深度学习,深度学习,bug,pytorch)