mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-08 22:48:25 -05:00
@@ -1,6 +1,6 @@
|
||||
import unittest
|
||||
import unittest, pickle
|
||||
from tinygrad.tensor import Tensor
|
||||
from tinygrad.dtype import dtypes, DType, ImageDType, PtrDType, to_dtype
|
||||
from tinygrad.dtype import dtypes, DType, ImageDType, PtrDType, to_dtype, Invalid, InvalidType
|
||||
|
||||
class TestImageDType(unittest.TestCase):
|
||||
def test_image_scalar(self):
|
||||
@@ -82,5 +82,12 @@ class TestCanLosslessCast(unittest.TestCase):
|
||||
self.assertTrue(can_lossless_cast(dtypes.int8, dtypes.half))
|
||||
self.assertFalse(can_lossless_cast(dtypes.int8, dtypes.bfloat16))
|
||||
|
||||
class TestInvalidSingleton(unittest.TestCase):
|
||||
def test_singleton(self):
|
||||
self.assertIs(InvalidType(), InvalidType())
|
||||
self.assertIs(InvalidType(), Invalid)
|
||||
def test_pickle(self):
|
||||
self.assertIs(pickle.loads(pickle.dumps(Invalid)), Invalid)
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user