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

Function to_python_float

fp16/fp16util.py:191–195  ·  view source on GitHub ↗
(t)

Source from the content-addressed store, hash-verified

189# Backward compatibility fixes
190
191def to_python_float(t):
192 if hasattr(t, 'item'):
193 return t.item()
194 else:
195 return t[0]
196
197TORCH_MAJOR = int(torch.__version__.split('.')[0])
198TORCH_MINOR = int(torch.__version__.split('.')[1])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected