File "/home/kurian/Projects/pytorch-ssd/.env/lib/python3.7/site-packages/torch/nn/functional.py", line 1871, in nll_loss
    ret = torch._C._nn.nll_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index)
RuntimeError: invalid argument 2: dimension -1 out of range of 2D tensor at /pytorch/aten/src/TH/generic/THTensor.cpp:37

I am getting a very strange error, which on googling does not lead to any solution. There is also a deprecated warning which I feel has some relation to this error message:
/home/kurian/Projects/pytorch-ssd/.env/lib/python3.7/site-packages/torch/nn/_reduction.py:46: UserWarning: size_average and reduce args will be deprecated, please use reduction='sum' instead.
  warnings.warn(warning.format(ret))