Could you try to use torch.stack instead of torch.FloatTensor to create your loss_group:
loss_group = torch.stack(loss_group)

If you are creating a new tensor e.g. by using FloatTensor, you will detach the input from the computation graph.