def NormalizeFex(real_features, fake_features):

    real_features_max, _ = real_features.view(real_features.size(0), real_features.size(1), -1).max(dim=2)
    fake_features_max, _ = fake_features.view(fake_features.size(0), fake_features.size(1), -1).max(dim=2)

    features_max = torch.max(real_features_max, fake_features_max).unsqueeze(2).unsqueeze(3).data

    real_features = real_features / (features_max + 1e-7)
    fake_features = fake_features / (features_max + 1e-7)

    return real_features, fake_features

Is it correct to use data in the maximum value ?
the inputs are features extracted from VGG and I want to normalize them cross channel between o and 1. knowing that the real features should not have gradient.