最新消息: USBMI致力于为网友们分享Windows、安卓、IOS等主流手机系统相关的资讯以及评测、同时提供相关教程、应用、软件下载等服务。

pytorch错误记录:TypeError: Cannot handle this data type: (1, 1, 64),

IT圈 admin 37浏览 0评论

pytorch错误记录:TypeError: Cannot handle this data type: (1, 1, 64),

经过测试:

pairwise_distance函数在pytorch1.7上的表现与pytorch1.10/pytorch1.11上有区别,代码如下

pytorch1.7上

feat_A的size是1,64,64,64,feat_B的size是1,64,64,64

出来应该size是1,1,64,64

而在pytorch1.10/pytorch1.11

出来的size是1,64,64,1

import torch.nn.functional as Fself.dist = F.pairwise_distance(self.feat_A, self.feat_B, keepdim=True)

直接导致了进一步的计算图像大小存不出来

image_pil = Image.fromarray(image_numpy)File "D:\software\Anaconda3\envs\pt3.8\lib\site-packages\PIL\Image.py", line 2815, in fromarrayraise TypeError("Cannot handle this data type: %s, %s" % typekey) from e
TypeError: Cannot handle this data type: (1, 1, 64), |u1

解决方式只能是版本回退

pytorch错误记录:TypeError: Cannot handle this data type: (1, 1, 64),

经过测试:

pairwise_distance函数在pytorch1.7上的表现与pytorch1.10/pytorch1.11上有区别,代码如下

pytorch1.7上

feat_A的size是1,64,64,64,feat_B的size是1,64,64,64

出来应该size是1,1,64,64

而在pytorch1.10/pytorch1.11

出来的size是1,64,64,1

import torch.nn.functional as Fself.dist = F.pairwise_distance(self.feat_A, self.feat_B, keepdim=True)

直接导致了进一步的计算图像大小存不出来

image_pil = Image.fromarray(image_numpy)File "D:\software\Anaconda3\envs\pt3.8\lib\site-packages\PIL\Image.py", line 2815, in fromarrayraise TypeError("Cannot handle this data type: %s, %s" % typekey) from e
TypeError: Cannot handle this data type: (1, 1, 64), |u1

解决方式只能是版本回退

发布评论

评论列表 (0)

  1. 暂无评论