def norm(x):
    out = ((x - 0.5) * 2.0)
    if isinstance(x, torch.Tensor):
        return out.clamp((- 1), 1)
    elif isinstance(x, np.ndarray):
        return np.clip(out, (- 1), 1)
    else:
        raise TypeError('Got unexpected object type, expected torch.Tensor or         np.ndarray')
def norm(x):
    out = ((x - 0.5) * 2.0)
    if isinstance(x, torch.Tensor):
        return out.clamp((- 1), 1)
    elif isinstance(x, np.ndarray):
        return np.clip(out, (- 1), 1)
    else:
        raise TypeError('Got unexpected object type, expected torch.Tensor or         np.ndarray')