|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本人刚接触python,想要复现github上的一个项目,在jupyter notebook上跑代码时遇到了一个错误,尝试了许多方法都解决不了
- C:\Users\Administrator\DeepTTE\main.py:129: DeprecationWarning: inspect.getargspec() is deprecated, use inspect.signature() or inspect.getfullargspec()
- model_args = inspect.getargspec(model_class.__init__).args
- ---------------------------------------------------------------------------
- TypeError Traceback (most recent call last)
- ~\DeepTTE\main.py in <module>()
- 159
- 160 if __name__ == '__main__':
- --> 161 run()
-
- ~\DeepTTE\main.py in run()
- 143
- 144 # model instance
- --> 145 model = models.DeepTTE.Net(**kwargs)
- 146
- 147 # experiment logger
-
- ~\DeepTTE\models\DeepTTE.py in __init__(self, kernel_size, num_filter, pooling_method, num_final_fcs, final_fc_size, alpha)
- 89 self.alpha = alpha
- 90
- ---> 91 self.build()
- 92 self.init_weight()
- 93
-
- ~\DeepTTE\models\DeepTTE.py in build(self)
- 107 kernel_size = self.kernel_size, \
- 108 num_filter = self.num_filter, \
- --> 109 pooling_method = self.pooling_method
- 110 )
- 111
-
- ~\DeepTTE\SpatioTemporal.py in __init__(self, attr_size, kernel_size, num_filter, pooling_method, rnn)
- 20 self.pooling_method = pooling_method
- 21
- ---> 22 self.geo_conv = GeoConv.Net(kernel_size = kernel_size, num_filter = num_filter)
- 23 #num_filter: output size of each GeoConv + 1:distance of local path + attr_size: output size of attr component
- 24 if rnn == 'lstm':
-
- ~\DeepTTE\GeoConv.py in __init__(self, kernel_size, num_filter)
- 15 self.num_filter = num_filter
- 16
- ---> 17 self.build()
- 18
- 19 def build(self):
-
- ~\DeepTTE\GeoConv.py in build(self)
- 20 self.state_em = nn.Embedding(2, 2)
- 21 self.process_coords = nn.Linear(4, 16)
- ---> 22 self.conv = nn.Conv1d(16, self.num_filter, self.kernel_size)
- 23
- 24 def forward(self, traj, config):
-
- D:\anaconda\lib\site-packages\torch\nn\modules\conv.py in __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, groups, bias, padding_mode, device, dtype)
- 288 super(Conv1d, self).__init__(
- 289 in_channels, out_channels, kernel_size_, stride_, padding_, dilation_,
- --> 290 False, _single(0), groups, bias, padding_mode, **factory_kwargs)
- 291
- 292 def _conv_forward(self, input: Tensor, weight: Tensor, bias: Optional[Tensor]):
-
- D:\anaconda\lib\site-packages\torch\nn\modules\conv.py in __init__(self, in_channels, out_channels, kernel_size, stride, padding, dilation, transposed, output_padding, groups, bias, padding_mode, device, dtype)
- 130 else:
- 131 self.weight = Parameter(torch.empty(
- --> 132 (out_channels, in_channels // groups), *kernel_size), **factory_kwargs))
- 133 if bias:
- 134 self.bias = Parameter(torch.empty(out_channels, **factory_kwargs))
-
- TypeError: empty(): argument 'size' must be tuple of ints, but found element of type NoneType at pos 3
-
复制代码
我尝试将132行中的kernel_size和out_channels两个参数分别强制转换成int类型,但是仍然报同样的错误
我认为是这个conv.py文件中pos3位置的参数类型不对,但是我修改后也没有成功
请各位来帮忙看下 |
|