mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-04-29 03:00:14 -04:00
ull literal support and test (#5789)
* ull literal support and test * missing .numpy()
This commit is contained in:
@@ -267,7 +267,10 @@ class TestInt32DType(TestDType): DTYPE = dtypes.int32
|
||||
class TestUint32DType(TestDType): DTYPE = dtypes.uint32
|
||||
|
||||
class TestInt64DType(TestDType): DTYPE = dtypes.int64
|
||||
class TestUint64DType(TestDType): DTYPE = dtypes.uint64
|
||||
class TestUint64DType(TestDType):
|
||||
DTYPE = dtypes.uint64
|
||||
def test_uint64_load(self):
|
||||
assert Tensor(2**64 - 1, dtype=dtypes.uint64).numpy() == 2**64 - 1
|
||||
|
||||
class TestBoolDType(TestDType): DTYPE = dtypes.bool
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ class CStyleLanguage(Renderer):
|
||||
elif math.isinf(x): val = ("-" if x < 0 else "") + "INFINITY"
|
||||
elif dtype.scalar() == dtypes.bool: val = "1" if x else "0"
|
||||
elif dtype.scalar() == dtypes.float: val = f"{x}f"
|
||||
elif dtype.scalar() == dtypes.uint64: val = f"{x}ULL"
|
||||
else: val = str(x)
|
||||
if dtype.count > 1: return self.render_vectorize([val] * dtype.count, dtype)
|
||||
return (self.render_cast(val, dtype) if dtype not in [dtypes.float, dtypes.int, dtypes.bool] else val)
|
||||
|
||||
Reference in New Issue
Block a user