只用一个卡可用时,要在后边添加逗号 ,
parser.add_argument('-d', '--sys_device_ids', type=eval, default=(0,))
修改为
ValueError: Expected more than 1 value per channel when training, got input size [1, 256, 1, 1]
可能是输入批次只有一个数据点,而由于BatchNorm操作需要多于一个数据计算平均值,因此造成该错误。
解决方法:在获取数据集时,将DataLoader中drop_last设置为True。
把不够一个批次的数据丢弃。
Pytorch 多GPU multi-GPU使用 RuntimeError: all tensors must be on devices[0]
pytorch出现RuntimeError: CUDA out of memory.
在eval的时候 加上
with torch.no_grad():
output = net(input,inputcoord)
windows下运行pytorchBrokenPipeError: [Errno 32] Broken pipe
该问题的产生是由于windows下多线程的问题,和DataLoader类有关
修改调用torch.utils.data.DataLoader()函数时的 num_workers 参数。
修改num_works参数为 0 ,只启用一个主进程加载数据集,避免在windows使用多线程即可