MCPcopy Create free account
hub / github.com/THUDM/GLM / to_python_float

Function to_python_float

fp16/loss_scaler.py:20–24  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

18
19# item() is a recent addition, so this helps with backward compatibility.
20def to_python_float(t):
21 if hasattr(t, 'item'):
22 return t.item()
23 else:
24 return t[0]
25
26class LossScaler:
27 """

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected