最近在实验中发现了改错误进行一下记录,后续会公布错误原因和解决方法
Traceback (most recent call last):
File "/home/jsh/python/myproject/get_feature.py", line 163, in <module>
get_deatures(model,base_out_dir,base_data_loader)
File "/home/jsh/python/myproject/get_feature.py", line 62, in get_deatures
outputs = model(temp_img) # torch.Size([128, 2])
File "/home/jsh/anaconda3/envs/one/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
File "/home/jsh/python/myproject/model/AlexNet_features.py", line 49, in forward
feature = self.conv(img)
File "/home/jsh/anaconda3/envs/one/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
File "/home/jsh/anaconda3/envs/one/lib/python3.6/site-packages/torch/nn/modules/container.py", line 100, in forward
input = module(input)
File "/home/jsh/anaconda3/envs/one/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in __call__
result = self.forward(*input, **kwargs)
File "/home/jsh/anaconda3/envs/one/lib/python3.6/site-packages/torch/nn/modules/pooling.py", line 141, in forward
self.return_indices)
File "/home/jsh/anaconda3/envs/one/lib/python3.6/site-packages/torch/_jit_internal.py", line 181, in fn
return if_false(*args, **kwargs)
File "/home/jsh/anaconda3/envs/one/lib/python3.6/site-packages/torch/nn/functional.py", line 488, in _max_pool2d
input, kernel_size, stride, padding, dilation, ceil_mode)
RuntimeError: non-empty 3D or 4D input tensor expected but got ndim: 4