当前位置:网站首页>Pytorch问题总结
Pytorch问题总结
2022-08-04 05:29:00 【视觉菜鸟Leonardo】
1.使用多线程时报错:
将程序加入到
if __name__ == "__main__" 中

Pytorch使用多线程加载数据报错_Restart丶的博客-CSDN博客_pytorch多线程加载数据
2.使用jupyter时,报错:内核挂掉了,需要重启

解决:加入以下代码![]()
结果:

jupyter notebook内核挂掉了,需要重启_取个名字真难呐的博客-CSDN博客_挂掉的内核
3.导入torchvision时,报错:python无法找到入口,无法定位程序输入点

问题:torch版本和torchvision版本不对应,需要查看版本,卸载后重新下载

https://github.com/pytorch/vision#installation
4.使用graphviz查看网络结构图时报错:
ExecutableNotFound: failed to execute [‘dot’, ‘-Tsvg’], make sure the Graphviz executables are on your systems
不仅要在conda中下载graphviz,还需要去官网下载一个软件并且配置到环境变量中
注意:先安装软件再用conda下载graphviz,不然一定报错
安装graphviz和python -graphviz
5.NotImplementedError报错:

问题:(1)定义前向传播的函数 forward()出问题,检查:
①函数名拼写对不对
②函数格式有没有对齐,或者对齐错误
(2)定义的类中,def 函数没有对齐

6.ValueError: num must be 1 <= num <= 6, not 9
如果三个整数是行数、列数和索引值,子图将分布在行列的索引位置上。索引从1开始,从右上角增加到右下角。
在使用plt.subplot(a,b,c)时,函数代表有a行b列,c代表索引值,c会根据行列数来自动判断位于第几行第几列
a=3,b=4,c=1:3行4列的图像组合,此图像位于第一行第一个
a=3,b=4,c=4:3行4列的图像组合,此图像位于第一行第四个
a=3,b=4,c=5:3行4列的图像组合,此图像位于第二行第一个
注意:c<=a*b
6. OMP: Error #15: Initializing libiomp5md.dll, but found libiomp5md.dll already initialized.

在最开头引入:(允许副本存在)
import os
os.environ['KMP_DUPLICATE_LIB_OK']='True'
7.RuntimeError: CUDA out of memory. Tried to allocate 20.00 MiB (GPU 0; 4.00 GiB total capacity; 2.44
gpu显卡内存不足,可以打开任务管理器查看

也可以在控制台中输入 nvidia-smi查看:

解决:在报错的语句上面一行加入:
if hasattr(torch.cuda, 'empty_cache'):
torch.cuda.empty_cache()也可以(1)重启电脑
(2)关掉后台PID对应的python程序(重启内核)

边栏推荐
- Image-Adaptive YOLO for Object Detection in Adverse Weather Conditions
- [Deep Learning 21-Day Learning Challenge] 3. Use a self-made dataset - Convolutional Neural Network (CNN) Weather Recognition
- TensorFlow2学习笔记:4、第一个神经网模型,鸢尾花分类
- 剑指 Offer 2022/7/8
- 读研碎碎念
- postgresql 游标(cursor)的使用
- 剑指 Offer 2022/7/5
- 图像resize
- 剑指 Offer 2022/7/3
- flink-sql所有语法详解
猜你喜欢
随机推荐
Various commands such as creating a new user in postgresql
(六)递归
Androd Day02
Jupyter Notebook安装库;ModuleNotFoundError: No module named ‘plotly‘解决方案。
【深度学习21天学习挑战赛】0、搭建学习环境
Introduction of linear regression 01 - API use cases
(TensorFlow) - detailed explanation of tf.variable_scope and tf.name_scope
图像合并水平拼接
[Deep Learning 21 Days Learning Challenge] Memo: What does our neural network model look like? - detailed explanation of model.summary()
TensorFlow2 study notes: 7. Optimizer
fill_between in Matplotlib; np.argsort() function
flink-sql所有语法详解
thymeleaf中 th:href使用笔记
Learning curve learning_curve function in sklearn
动手学深度学习__数据操作
Logistic Regression --- Introduction, API Introduction, Case: Cancer Classification Prediction, Classification Evaluation, and ROC Curve and AUC Metrics
SQL练习 2022/7/3
yolov3数据读入(二)
完美解决keyby造成的数据倾斜导致吞吐量降低的问题
[Go language entry notes] 13. Structure (struct)







