When I was training, the following problems occurred in the middle of my training.
looking forward to your reply.
2020-09-08 09:50:59.346583 Iter: 2880 Loss: 0.171822
Wait until the dataprocesses to end
Traceback (most recent call last):
File "main.py", line 121, in
main()
File "main.py", line 111, in main
train_net()
File "/home/zyz/Project/3D-R2N2-PyTorch/lib/train_net.py", line 24, in func_wrapper
return func(*args, **kwargs)
File "/home/zyz/Project/3D-R2N2-PyTorch/lib/train_net.py", line 84, in train_net
solver.train(train_loader, val_loader)
File "/home/zyz/Project/3D-R2N2-PyTorch/lib/solver.py", line 117, in train
loss = self.train_loss(batch_img, batch_voxel)
File "/home/zyz/Project/3D-R2N2-PyTorch/lib/solver.py", line 65, in train_loss
loss = self.net(x, y, test=False)
File "/home/zyz/anaconda3/envs/3D-R2N2/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/zyz/Project/3D-R2N2-PyTorch/models/base_gru_net.py", line 76, in forward
gru_out, update_gate = self.encoder(x[time], h, u, time)
File "/home/zyz/anaconda3/envs/3D-R2N2/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/zyz/Project/3D-R2N2-PyTorch/models/res_gru_net.py", line 155, in forward
t_x_s_update = self.t_x_s_update(rect7, h)
File "/home/zyz/anaconda3/envs/3D-R2N2/lib/python3.6/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/home/zyz/Project/3D-R2N2-PyTorch/lib/layers.py", line 45, in forward
out = self.fc_layer(fc7).view(*target_shape) + self.conv3d(h) + self.bias
RuntimeError: The size of tensor a (5) must match the size of tensor b (12) at non-singleton dimension 0
I have met the same problem and later I solve with it.
You only need to add "drop_last=True" to the data_loader.
I hope it will be helpful.
Thank u.