MCPcopy
hub / github.com/tinygrad/tinygrad / _to_python_const

Function _to_python_const

tinygrad/nn/onnx.py:362–363  ·  view source on GitHub ↗
(t:Tensor)

Source from the content-addressed store, hash-verified

360}
361
362def _to_python_const(t:Tensor) -> list[ConstType]|ConstType|bytes:
363 return t.data().tobytes() if t.dtype == dtypes.uint8 else cast(list[ConstType]|ConstType, t.tolist())
364
365# ***** runner ******
366debug = int(getenv("DEBUGONNX", "0"))

Callers 3

_get_python_constMethod · 0.85
__call__Method · 0.85
IfFunction · 0.85

Calls 3

castFunction · 0.85
dataMethod · 0.45
tolistMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…