Thanks for the answer.
I tried reworking my code to keep all my calculations in tensors and I’ve manage to get grad for the drawn image tensor although the image tensor and the current_loss tensor still have grad None and therefore the backward doesn’t update anything.
Would you have any ideas on what to look at next?
Image loading
    image = cv2.imread("flower.png")
    image = cv2.resize(image, (10, 10))
    image = image.astype(np.float32)
    image = torch.tensor(image, requires_grad=True)

    image = torch.flatten(image, start_dim=1)