MCPcopy
hub / github.com/tinygrad/tinygrad / cast

Function cast

test/mockgpu/amd/pcode.py:133–133  ·  view source on GitHub ↗
(v: UOp)

Source from the content-addressed store, hash-verified

131
132def _minmax_reduce(is_max: bool, dt, *args: UOp) -> UOp:
133 def cast(v: UOp) -> UOp: return v.bitcast(dt) if dt == dtypes.float32 and v.dtype == dtypes.uint32 else v.cast(dt)
134 def minmax(a: UOp, b: UOp) -> UOp:
135 if dt in (dtypes.uint8, dtypes.uint16, dtypes.uint32, dtypes.uint64): return (a > b).where(a, b) if is_max else (a < b).where(a, b)
136 return a.maximum(b) if is_max else a.minimum(b)

Callers 15

__call__Method · 0.85
canonicalize_stridesFunction · 0.85
compute_gradientFunction · 0.85
_bufferMethod · 0.85
shardMethod · 0.85
from_blobMethod · 0.85
randMethod · 0.85
_getitemMethod · 0.85
_renderMethod · 0.85
from_uopsMethod · 0.85
renderMethod · 0.85
_render_kernelMethod · 0.85

Calls 2

bitcastMethod · 0.45
castMethod · 0.45

Tested by 3

test_mnist_valMethod · 0.68
isel_rewriteMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…