When i try to train my model using the nightly auto mixed precision mode i get this error:
Traceback (most recent call last):
  File "src/train.py", line 101, in <module>
    init_phase(
  File "src/train.py", line 48, in init_phase
    loss = content_loss(fakes, images)
  File "E:\program\anaconda\envs\torch_n\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "D:\C_GAN\src\loss.py", line 92, in forward
    l = self.base_loss(x, y)
  File "E:\program\anaconda\envs\torch_n\lib\site-packages\torch\nn\modules\module.py", line 722, in _call_impl
    result = self.forward(*input, **kwargs)
  File "E:\program\anaconda\envs\torch_n\lib\site-packages\torch\nn\modules\loss.py", line 813, in forward
    return F.smooth_l1_loss(input, target, reduction=self.reduction)
  File "E:\program\anaconda\envs\torch_n\lib\site-packages\torch\nn\functional.py", line 2581, in smooth_l1_loss
    ret = _smooth_l1_loss(input, target)
  File "E:\program\anaconda\envs\torch_n\lib\site-packages\torch\nn\functional.py", line 2557, in _smooth_l1_loss
    return torch.where(t < 1, 0.5 * t ** 2, t - 0.5)
RuntimeError: expected scalar type float but found struct c10::Half

The remaining code is quite similar to that of https://pytorch.org/docs/stable/notes/amp_examples.html 1
The loss is found here: https://gist.github.com/brucemuller/37906a86526f53ec7f50af4e77d025c9 1
How should i change the loss to make it work correctly?