当前位置:   article > 正文

pytorch报错及坑_herkernel.cu:365: operator(): block: [0,0,0], thre

herkernel.cu:365: operator(): block: [0,0,0], thread: [0,0,0] assertion `idx

以下均为pytorch 1.0.1的报错和原因

 

1、报错:

block: [0,0,0], thread: [16,0,0] Assertion t 0 && t n_classes failed

原因是训练列表里标签的问题

 

2、在win下用交叉熵损失,要设num_workers = 0,多线程会报错

 

3、报错:

Sizes of tensors must match except in dimension 0. Got 36 and 234 in dimension 2

原因是输入数据没有resize到统一尺寸

 

4、坑:toTensor会自动将数据转为0-1之间,如果数据类型是np.float32,则将数据转为[0,1],如果数据类型是np.uint8则会对每个数除以255,注意用toTensor的话数据类型很关键

本文内容由网友自发贡献,转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/263684
推荐阅读
相关标签
  

闽ICP备14008679号