(name:str, min_val:ConstType, max_val:ConstType, dtype:DType=dtypes.weakint)
| 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" |