def denorm(x, min_max=((- 1.0), 1.0)):
    '\n        Denormalize from [-1,1] range to [0,1]\n        formula: xi\' = (xi - mu)/sigma\n        Example: "out = (x + 1.0) / 2.0" for denorm\n            range (-1,1) to (0,1)\n        for use with proper act in Generator output (ie. tanh)\n    '
    out = ((x - min_max[0]) / (min_max[1] - min_max[0]))
    if isinstance(x, torch.Tensor):
        return out.clamp(0, 1)
    elif isinstance(x, np.ndarray):
        return np.clip(out, 0, 1)
    else:
        raise TypeError('Got unexpected object type, expected torch.Tensor or         np.ndarray')
Denormalize from [-1,1] range to [0,1]
formula: xi' = (xi - mu)/sigma
Example: "out = (x + 1.0) / 2.0" for denorm
    range (-1,1) to (0,1)
for use with proper act in Generator output (ie. tanh)
def denorm(x, min_max=((- 1.0), 1.0)):
    '\n        Denormalize from [-1,1] range to [0,1]\n        formula: xi\' = (xi - mu)/sigma\n        Example: "out = (x + 1.0) / 2.0" for denorm\n            range (-1,1) to (0,1)\n        for use with proper act in Generator output (ie. tanh)\n    '
    out = ((x - min_max[0]) / (min_max[1] - min_max[0]))
    if isinstance(x, torch.Tensor):
        return out.clamp(0, 1)
    elif isinstance(x, np.ndarray):
        return np.clip(out, 0, 1)
    else:
        raise TypeError('Got unexpected object type, expected torch.Tensor or         np.ndarray')