MCPcopy Create free account
hub / github.com/twitter/the-algorithm-ml / _smooth

Function _smooth

metrics/rce.py:14–24  ·  view source on GitHub ↗

Smooth given values. Args: value: Value to smooth. label_smoothing: smoothing constant. Returns: Smoothed values.

(
  value: torch.Tensor, label_smoothing: Union[float, torch.Tensor]
)

Source from the content-addressed store, hash-verified

12
13
14def _smooth(
15 value: torch.Tensor, label_smoothing: Union[float, torch.Tensor]
16) -> Union[float, torch.Tensor]:
17 """
18 Smooth given values.
19 Args:
20 value: Value to smooth.
21 label_smoothing: smoothing constant.
22 Returns: Smoothed values.
23 """
24 return value * (1.0 - label_smoothing) + 0.5 * label_smoothing
25
26
27def _binary_cross_entropy_with_clipping(

Callers 2

updateMethod · 0.85
updateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected