mirror of
https://github.com/tinygrad/tinygrad.git
synced 2026-01-10 07:28:15 -05:00
This reverts commit af0452f116.
This commit is contained in:
@@ -298,7 +298,7 @@ class TestDiskTensor(unittest.TestCase):
|
||||
ret = t.bitcast(dtypes.uint16).to("CLANG") + 1
|
||||
assert ret.tolist() == [2827, 3341, 3855, 4369]
|
||||
|
||||
def _simulate_bf16_disk_tensor(self):
|
||||
def test_bf16_disk_write_read(self):
|
||||
t = Tensor([10000, -1, -1000, -10000, 20], dtype=dtypes.float32)
|
||||
t.to(f"disk:{temp('dt_bf16_disk_write_read_f32')}").realize()
|
||||
|
||||
@@ -308,17 +308,8 @@ class TestDiskTensor(unittest.TestCase):
|
||||
with open(temp('dt_bf16_disk_write_read_bf16'), "wb") as f: f.write(adat)
|
||||
|
||||
t = Tensor.empty(5, dtype=dtypes.bfloat16, device=f"disk:{temp('dt_bf16_disk_write_read_bf16')}")
|
||||
ct = t.to(Device.DEFAULT)
|
||||
return ct, [9984., -1, -1000, -9984, 20]
|
||||
|
||||
@unittest.skipIf(Device.DEFAULT == "LLVM", "cast to float16 on llvmlite is not supported")
|
||||
def test_bf16_disk_write_read(self):
|
||||
t, val = self._simulate_bf16_disk_tensor()
|
||||
assert t.cast(dtypes.float16).numpy().tolist() == val
|
||||
|
||||
def test_bf16_disk_write_read_float32(self):
|
||||
t, val = self._simulate_bf16_disk_tensor()
|
||||
assert t.cast(dtypes.float32).numpy().tolist() == val
|
||||
ct = t.llvm_bf16_cast(dtypes.float)
|
||||
assert ct.numpy().tolist() == [9984., -1, -1000, -9984, 20]
|
||||
|
||||
def test_copy_from_disk(self):
|
||||
fn = pathlib.Path(temp("dt_copy_from_disk"))
|
||||
|
||||
Reference in New Issue
Block a user