Hi Blu!



 blu_head:

        image.requires_grad_(True).float()
        image = image * 1.0



The seemingly innocuous image = image * 1.0 creates a new
image (that is then assigned to the python reference variable image)
that, being the result of a tensor computation, is no longer a leaf
variable.
Consider:
>>> import torch
>>> torch.__version__
'1.9.0'
>>> image = torch.zeros (3, 5, requires_grad = True)
>>> image.is_leaf
True
>>> image = image * 1.0
>>> image.is_leaf
False

Best.
K. Frank