MCPcopy
hub / github.com/tinygrad/tinygrad / is_float

Method is_float

tinygrad/dtype.py:152–152  ·  view source on GitHub ↗
(x: DType)

Source from the content-addressed store, hash-verified

150 @staticmethod
151 @functools.cache
152 def is_float(x: DType) -> bool: return x.scalar() in dtypes.floats or isinstance(x, ImageDType)
153 @staticmethod # static methods on top, or bool in the type info will refer to dtypes.bool
154 @functools.cache
155 def is_int(x: DType) -> bool: return x.scalar() in (dtypes.ints + (dtypes.weakint,))

Callers 15

minMethod · 0.80
maxMethod · 0.80
constMethod · 0.80
finfoMethod · 0.80
dtype.pyFile · 0.80
least_upper_floatFunction · 0.80
randMethod · 0.80
render_valFunction · 0.80
ptx.pyFile · 0.80
modifierFunction · 0.80
lcastFunction · 0.80
_qlinearop_floatFunction · 0.80

Calls 1

scalarMethod · 0.80

Tested by 9

test_is_intMethod · 0.64
test_is_floatMethod · 0.64
test_bf16_is_floatMethod · 0.64
test_fp8s_are_floatMethod · 0.64
test_dtype_rangeMethod · 0.64
test_broadcast_scalarMethod · 0.64
test_where_one_scalarMethod · 0.64
test_maximum_constMethod · 0.64
custom_add_oneFunction · 0.64