Python报错:

ValueError: Type must be a sub-type of ndarray type

错误行:

outputs = outputs.view(tmp_batch*tmp_channel, -1)

修改方法:
numpy的数组array和torch中的tensor二者的view不同,需要使用reshape, 解决方法就是将代码中的view改为reshape即可。

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐