Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/AIS-SNU/Smart-Infinity
/ to_python_float
Function
to_python_float
DeepSpeedExample/megatron/fp16/fp16util.py:202–206 ·
view source on GitHub ↗
(t)
Source
from the content-addressed store, hash-verified
200
201
202
def
to_python_float(t):
203
if
hasattr(t,
'item'
):
204
return
t.item()
205
else
:
206
return
t[0]
207
208
209
TORCH_MAJOR = int(torch.__version__.split(
'.'
)[0])
Callers
nothing calls this directly
Calls
no outgoing calls
Tested by
no test coverage detected