自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(4)
  • 收藏
  • 关注

原创 RuntimeError: The size of tensor a (128) must match the size of tensor b (16) at non-singleton dimen

RuntimeError: The size of tensor a (128) must match the size of tensor b (16) at non-singleton dimension 0这个错误出现的原因有好多种!!其中一个比较可能的原因是因为:封装dataloader的时候,最后剩下的不足一个batchsize! 自带的dataloader就会有这个现象。改正:batch_size_s = len(targets) #不足一个batch_size直接停止训练if bat

2021-04-04 20:25:13 6913 5

原创 踩坑 SVHN数据集transforms不起作用

事情是这样的,SVHN数据集是一个三通道的RGB数据集,想把它转为单通道的灰度图,你在网上搜索大家都是下面这样使用的: train_dataset = SVHN('./data', split='train', download=True, transform=transforms.Compose([ transforms.Resize(28), transforms.Grayscale(num_output_c

2021-03-12 17:21:32 836 2

原创 TypeError: Cannot handle this data type: (1, 1, 28), |u1

PIL和numpy相互转换方式如下:from PIL import Image#PIL image转成numpynp_img = np.asarray(PIL_img) #参数时PIL类型的图片或 np_img = np.array(PIL_img)#将array准成PIL imageImage.fromarray(np.uint8(np_img))但是直接用Image.fromarray(np.uint8(data))转换会报错:TypeError: Cannot handle t

2021-03-12 17:18:34 15247 18

原创 踩坑 ValueError:only one element tensors can be converted to Python scalarsC

踩坑 ValueError:only one element tensors can be converted to Python scalarsClist 转 torch.Tensortensor=torch.Tensor(list)注意:有时,上面操作会出现报错:ValueError:only one element tensors can be converted to Python scalars原因是:要转换的list里面的元素包含多维的tensor。就像这个样子 [tensor,t

2021-03-12 16:56:52 18180 9

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除