Pytorch报错记录
- 作者: 五速梦信息网
- 时间: 2026年04月04日 13:30
1.BrokenPipeError
执行以下命令时:
a,b = iter(train_loader).next()
报错:BrokenPipeError: [Errno 32] Broken pipe
错误原因:子进程原因
On Windows the subprocesses will import (i.e. execute) the main module at start. You need to insert an if __name__ == '__main__': guard in the main module to avoid creating subprocesses recursively.
解决方法:
if __name__ == '__main__'
还有人说:I also got the same error. When I set num_workers to 0, the error does not appear again. However, when I set num_workers to 1, the error is still there.即将如下:
train_loader = data.DataLoader(dataset, batch_size=64, shuffle=True, num_workers=2, drop_last=False)
代码中的num_workers=0,但我改了以后还回报另外的错误。
2. 发现gpu并行运算出错,单个gpu没问题.
重新装了驱动:ubuntu18.04-rtx2080ti-nvidia driver 410.78-cuda9.0-cudnn-9.0-v7.5.1.10-将gcc和g++降级为4.8.
- 上一篇: PyTorch专栏(五):迁移学习
- 下一篇: pytorch 支撑向量机
相关文章
-
PyTorch专栏(五):迁移学习
PyTorch专栏(五):迁移学习
- 互联网
- 2026年04月04日
-
pytorch自动求导机制(autograd)
pytorch自动求导机制(autograd)
- 互联网
- 2026年04月04日
-
qlv 转 mp4 java 代码
qlv 转 mp4 java 代码
- 互联网
- 2026年04月04日
-
pytorch 支撑向量机
pytorch 支撑向量机
- 互联网
- 2026年04月04日
-
pytorch 移动端框架 thnets 附c示例代码
pytorch 移动端框架 thnets 附c示例代码
- 互联网
- 2026年04月04日
-
Python字典按值排序、包含字典的列表按字典值排序的方法
Python字典按值排序、包含字典的列表按字典值排序的方法
- 互联网
- 2026年04月04日






