ESRGAN datasets.py problem
Author: lizhuoqCreated Aug 9, 2023Updated Aug 9, 2023
In the denormalize function, the range for clamping the tensor should be between 0 and 1. This is because the input tensors to the function include one tensor processed by the ToTensor function and another tensor generated by the network. The valid value range for both of these tensors is between 0 and 1. Therefore, the denormalize function should be modified accordingl. Modify it as follows:
def denormalize(tensors):
''' channel in the second dim'''
for c in range(3):
tensors[:, c].mul_(std[c]).add_(mean[c]) # Underscores are in-place operations
return torch.clamp(tensors, 0, 1)Source: eriklindernoren/PyTorch-GAN