MCPcopy Create free account
hub / github.com/294coder/Dif-PAN / norm_data_range

Function norm_data_range

utils/misc.py:62–74  ·  view source on GitHub ↗

norm input to [-1, 1] Args: x (torch.Tensor): input Returns: torch.Tensor: output with data ranging in [-1, 1]

(x)

Source from the content-addressed store, hash-verified

60
61
62def norm_data_range(x):
63 """norm input to [-1, 1]
64
65 Args:
66 x (torch.Tensor): input
67
68 Returns:
69 torch.Tensor: output with data ranging in [-1, 1]
70 """
71 x = x - x.min()
72 x = x / x.max()
73 x = 2 * x - 1
74 return x
75
76
77def unnorm_data_range(x):

Callers 1

forwardMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected