pytorch中的分段错误

当我在python文件中运行此代码时,它会产生分段错误错误:

import torch
import numpy as np

model = torch.nn.Linear(10,1000)
data = torch.Tensor(np.zeros((50,10)))
model(data)

#Segmentation fault (core dumped)

当我在jupyter笔记本中运行相同的代码时,它运行良好。我什至可以将数据大小增加到(1000000,10),它仍然可以在jupyter笔记本中运行,因此看来我有足够的内存。当我将数据大小减小到(10,10)时,代码将在python文件中运行。

我有python 3.6,torch = 1.3.0,操作系统是Ubuntu 18.04

我尝试使用pdb调试器,发现分段错误发生在

ret = torch.addmm(bias,input,weight.t()) 

torch.nn.functional.linear模块中的行。

我也尝试过重新启动服务器,但没有帮助。

如何进行调试?

beibeiji 回答:pytorch中的分段错误

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3144975.html

大家都在问