I am very new about Pytorch, and when I use the default setting, and train the voc firstly, get the following error:
Loading base network...
Initializing weights...
Loading Dataset...
Training SSD on VOC0712
Traceback (most recent call last):
File "train.py", line 231, in
train()
File "train.py", line 183, in train
loss_l, loss_c = criterion(out, targets)
File "/home/mengyong/anaconda3/lib/python3.6/site-packages/torch/nn/modules/module.py", line 325, in __call__
result = self.forward(input, *kwargs)
File "/home/mengyong/Detection/ssd.pytorch/layers/modules/multibox_loss.py", line 83, in forward
num_pos = pos.sum(keepdim=True)
RuntimeError: sum() missing 1 required positional arguments: "dim"
Can you help me solve the problem, very thanks!
I met the same problem, have you solved it?
Yes, just set the error line
num_pos = pos.sum(keepdim=True)
as the new coding
num_pos = pos.sum(dim=1, keepdim=True)
all thing will be OK!
Importantly, you will find num_pos is defined newly in the following line, so you can just remove it, things also will be OK
@lmingyin Thanks!
Thanks for catching this, having a hard time keeping up with PyTorch updates!
@lmingyin hello,,i have some training issues?
Most helpful comment
Yes, just set the error line
num_pos = pos.sum(keepdim=True)as the new coding
num_pos = pos.sum(dim=1, keepdim=True)all thing will be OK!
Importantly, you will find
num_posis defined newly in the following line, so you can just remove it, things also will be OK