MCPcopy Create free account
hub / github.com/apple/ml-sharp / normalize

Function normalize

src/sharp/utils/math.py:93–95  ·  view source on GitHub ↗
(clamp_range: SoftClampRange)

Source from the content-addressed store, hash-verified

91 """
92
93 def normalize(clamp_range: SoftClampRange) -> torch.Tensor:
94 value0, value1 = clamp_range
95 return value0 + (value1 - value0) * torch.tanh((tensor - value0) / (value1 - value0))
96
97 tensor_clamped = tensor
98 if min is not None:

Callers 1

softclampFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected