@ptrblck So I reran the code after including torch.autograd.set_detect_anomaly(True), and this is the stack trace that I got as a result:
[W python_anomaly_mode.cpp:60] Warning: Error detected in SoftmaxBackward. Traceback of forward call that caused the error: 
File "pytorch_run.py", line 2437, in <module>
  joint_run() 
File "pytorch_run.py", line 2425, in joint_run
  trainer = Trainer(args) File "pytorch_run.py", line 1787, in __init__ model.setup() 
File "pytorch_run.py", line 1708, in setup 
  self.loss = self.find_loss(initial) 
File "pytorch_run.py", line 1450, in find_loss 
  self.loss = self.get_source_loss() + self.get_target_loss() 
File "pytorch_run.py", line 1409, in get_target_loss 
  self.target_loss = joint_loss(joint_logits) 
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/module.py", line 722, in _call_impl 
  result = self.forward(*input, **kwargs) 
File "/opt/conda/lib/python3.7/site-packages/torch/nn/modules/activation.py", line 1140, in forward 
  return F.softmax(input, self.dim, _stacklevel=5) 
File "/opt/conda/lib/python3.7/site-packages/torch/nn/functional.py", line 1498, in softmax 
  ret = input.softmax(dim) 
(function print_stack)

This error trace seems to indicate that the variable joint_logits is being modified in-place and is thus causing the problem, but I’m not sure why. As you can see in get_target_loss, it doesn’t seem to be modified in-place. I would appreciate it if you could provide your insights on this error.