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

Function _get_scale_activation_constant

src/sharp/models/composer.py:21–28  ·  view source on GitHub ↗

Return constants for scale activation function.

(max_scale: float, min_scale: float)

Source from the content-addressed store, hash-verified

19
20
21def _get_scale_activation_constant(max_scale: float, min_scale: float) -> tuple[float, float]:
22 """Return constants for scale activation function."""
23 # To ensure for delta = 0, the value of scale_factor is 1 and the gradient is 1.
24 constant_a = (max_scale - min_scale) / (1 - min_scale) / (max_scale - 1)
25 constant_b = math_utils.inverse_sigmoid(
26 torch.tensor((1.0 - min_scale) / (max_scale - min_scale))
27 ).item()
28 return constant_a, constant_b
29
30
31class GaussianComposer(nn.Module):

Callers 1

_scale_activationMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected