remove unreachable tensor dtype assert (#8190)

it would have failed in `to_dtype`. added some tests for it too
This commit is contained in:
chenyu
2024-12-12 13:04:49 -05:00
committed by GitHub
parent 2e4c7d4cfb
commit 72ff631f8d
2 changed files with 4 additions and 1 deletions

View File

@@ -424,6 +424,10 @@ class TestTinygrad(unittest.TestCase):
data = [np.array(1.0), np.array(2.0), np.array(3.0)]
np.testing.assert_equal(Tensor(data).numpy(), np.array(data))
def test_tensor_dtype_errors(self):
with self.assertRaises(AttributeError): Tensor([3], dtype="typo")
with self.assertRaises(TypeError): Tensor([3], dtype=(dtypes.int,))
def test_tensor_bytes(self):
data = b"abc123"
t = Tensor(data)