pytorch0.4-window:BUG记录

1.RuntimeError: freeze_support()

参考:https://github.com/pytorch/pytorch/issues/5858

加上:

if __name__ == '__main__':

2.log_p = F.log_softmax(input, dim=1)

pytorch的0.2版本不需要加维度,而>=0.3必须要加上维度

3.

UserWarning: invalid index of a 0-dim tensor. This will be an error in PyTorch 0.5. Use tensor.item() to convert a 0-dim tensor to a Python number

修改:if np.isnan(float(loss.item())):#loss.data[0]

4.

kwargs = {'num_workers': 0, 'pin_memory': True} if cuda else {}

其中num_workers>0的值都会出现如下错误:

BrokenPipeError: [Errno 32] Broken pipe

其中可能是使用多线程的原因,与windows平台有关

On a Windows machine, you may need to wrap your multiprocessing code inside:
if __name__ == '__main__'


https://github.com/pytorch/pytorch/issues/494#issuecomment-304439658

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值