RuntimeError: view size is not compatible with input tensor‘s size and stride
程序员文章站
2022-06-15 13:50:11
...
File "/home/yuanlina/PycharmProjects/ViT-pytorch-main/test1-10.py", line 136, in Accuracy
correct_k = correct[:k].view(-1).float().sum(0, keepdim=True)
correct_k = correct[:k].contiguous().view(-1).float().sum(0, keepdim=True)
correct_k = correct[:k].contiguous().view(-1).float().sum(0, keepdim=True)
添加.contiguous()即可
上一篇: MySQL分区表的使用
下一篇: 一篇文章带你了解Java基础-多态
推荐阅读
-
RuntimeError: view size is not compatible with input tensor‘s size and stride
-
PyTorch 错误 RuntimeError: view size is not compatible with input tensor‘s size and stride (at least o
-
RuntimeError: view size is not compatible with input tensor‘s size and stride
-
RuntimeError: view size is not compatible with input tensor‘s size and stride解决记录