I don’t quite understand the training as it seems you are calculating the loss via:
loss = loss_function(blender_image, input_img_arr[0])

where blender_image is loaded via PIL (and you are most ikely adding requires_grad=True to this tensor to avoid an error when calling loss.backward()) while input_img_arr is a tensor containing other images loaded by PIL. The model is not used to create any of these tensors and will thus not be trained, or is this your use case?