今天犯了一个很低级的错误。
打开服务器使用python命令训练网络报错:
Traceback (most recent call last):
File "Train.py", line 166, in <module>
result = G(input)
File "/home/cat/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
result = self.forward(*input, **kwargs)
File "/data1/cat/lab/network/Model.py", line 327, in forward
x_down1 = self.down1(input) # [bs, 64, 256, 256]
File "/home/cat/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
result = self.forward(*input, **kwargs)
File "/home/cat/anaconda3/lib/python3.7/site-packages/torch/nn/modules/container.py", line 92, in forward
input = module(input)
File "/home/cat/anaconda3/lib/python3.7/site-packages/torch/nn/modules/module.py", line 493, in __call__
result = self.forward(*input, **kwargs)
File "/home/cat/anaconda3/lib/python3.7/site-packages/torch/nn/modules/conv.py", line 338, in forward
self.padding, self.dilation, self.groups)
RuntimeError: cuda runtime error (8) : invalid device function at /pytorch/aten/src/THC/THCGeneral.cpp:383
找了半天还以为是代码的问题,然后我突然发现我没启动虚拟环境。
故使用如下命令启动虚拟环境:
conda activate your_environment_name
标签:function,src,self,py,__,File,input,line,THCGeneral
From: https://www.cnblogs.com/chengcat/p/18037870