MCPcopy Index your code
hub / github.com/tinygrad/tinygrad / variable

Method variable

tinygrad/uop/ops.py:838–840  ·  view source on GitHub ↗
(name:str, min_val:ConstType, max_val:ConstType, dtype:DType=dtypes.weakint)

Source from the content-addressed store, hash-verified

836
837 @staticmethod
838 def variable(name:str, min_val:ConstType, max_val:ConstType, dtype:DType=dtypes.weakint) -> UOp:
839 assert not isinstance(min_val, UOp) and not isinstance(max_val, UOp), f"can't create Variable {name} with {min_val}/{max_val}"
840 return UOp(Ops.DEFINE_VAR, dtype, arg=(name, min_val, max_val))
841 @property
842 def expr(self) -> str:
843 assert self.op is Ops.DEFINE_VAR, f"op is {self.op}, need DEFINE_VAR"

Callers 15

generateMethod · 0.80
_embedding_bwd_kernelFunction · 0.80
_unshardMethod · 0.80
_shardMethod · 0.80
uop_given_validFunction · 0.80
__init__Method · 0.80
add_gpudimsFunction · 0.80
reduce_collapseFunction · 0.80
rangeify.pyFile · 0.80
VariableFunction · 0.80
test_masked_shr_foldMethod · 0.80

Calls 1

UOpClass · 0.85

Tested by 15

VariableFunction · 0.64
test_masked_shr_foldMethod · 0.64
test_simpleMethod · 0.64
test_rewritesMethod · 0.64
test_stepsMethod · 0.64
test_rewrite_locationMethod · 0.64
test_default_nameMethod · 0.64
test_dyn_name_fxnMethod · 0.64
test_tracing_keyMethod · 0.64
test_profile_matchesMethod · 0.64