YOLOv3, loss.backwards() issue

Hi, any help will be really greatly appreciated!

I’m implementing YOLO v3 for the first time, and I can’t understand why my loss.backward() just returns None. This results in the weights of the model failing to update so the loss always stays the same over all iterations. For now I’m just testing it with a single image and test pair.


optimizer = torch.optim.Adam(model.parameters(), lr=0.01)
for epoch in np.arange(epoch_num):
  print('epoch: {}'.format(epoch))
  inp = Variable(get_test_input('movie09_-5.jpg').cuda(), requires_grad=True)
  targets = Variable(torch.LongTensor(bboxes))
  outputs = model.forward(inp, True)
  loss = loss_iou(outputs, targets)

maybe you forgot to designate the weights as parameters