pytorch笔记

参考资料

文档

https://github.com/jcjohnson/pytorch-examples

https://pytorch.org/docs/stable/index.html

(pytorch中文官方文档)https://pytorch-cn.readthedocs.io/zh/latest/package_references/torch-optim/

视频

https://www.bilibili.com/video/BV1tk4y1q7Jv/?spm_id_from=333.788&vd_source=3f409e335d99edd58fc22f4c59f6ae9e

一些坑

1、加载Mnist数据集的坑

print("下载训练集中...")
train_set = torchvision.datasets.MNIST(".\data", train=True, download=True, transform=pipeline)
print("下载测试集中...")
test_set = torchvision.datasets.MNIST(".\data", train=False, download=True, transform=pipeline)

image
UserWarning: The given NumPy array is not writeable, and PyTorch does not support non-writeable tensors. This means you can write to the underlying (supposedly non-writeable) NumPy array using the tensor. You may want to copy the array to protect its data or make it writeable before converting it to a tensor. This type of warning will be suppressed for the rest of this program. (Triggered internally at ..\torch\csrc\utils\tensor_numpy.cpp:180.)
return torch.from_numpy(parsed.astype(m[2], copy=False)).view(*s)

解决方法:直接定位到错误的地方,删掉, copy=False,就正常了
image
image

2、

posted @ 2022-08-22 22:36  JaxonYe  阅读(155)  评论(0)    收藏  举报