From 4fb29cc0c4a68efa183c21a0303dcfc19dc6315c Mon Sep 17 00:00:00 2001 From: George Hotz Date: Thu, 30 Apr 2026 07:02:54 -0700 Subject: [PATCH] const assert --- tinygrad/uop/ops.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tinygrad/uop/ops.py b/tinygrad/uop/ops.py index 80f14e2963..509d58433d 100644 --- a/tinygrad/uop/ops.py +++ b/tinygrad/uop/ops.py @@ -493,6 +493,7 @@ class UOp(OpMixin, metaclass=UOpMetaClass): return UOp(op, out_dtype, all_srcs, **kwargs) @staticmethod def const(dtype:DType, b:ConstLike, device:str|tuple[str, ...]|None=None, shape:tuple[sint, ...]|None=None): + if shape == (): assert dtype.count == 1, "if shape is () you can't have a vec dtype" if isinstance(b, UOp): return b.unbind()[0] if b.op is Ops.BIND else b if isinstance(b, tuple) and all_same(b): assert len(b) > 0, "can't create const from empty tuple"