Thanks for the explanation. 



 albanD:

You might want to create a new environment in your conda so that you can install things.


I will have to look into this.
But, if I stick to this code above. What do you think is the correct way to calculate cont_loss_weight by Idea-1 or Idea-2?
And what changes should I make in the code of backward to run it successfully, any suggestions?
I tried this as well without nightly version, but GPU went out of memory. 



 albanD:

(ce_loss + additional_loss).backward()


RuntimeError: CUDA out of memory.