报错:RuntimeError: view size is not compatible with input tensor‘s size and stride (at least one dimen

报错:RuntimeError: view size is not compatible with input tensor's size and stride (at least one dimension spans across two contiguous subspaces). Use .reshape(...) instead.

 

解决方法:

在view()前加入.contiguous()

参考:

python运行报错RuntimeError: view size is not compatible with input tensor‘s size and stride (at least..)_柠檬树下你和我₰的博客-CSDN博客


版权声明:本文为weixin_41243988原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。