Skip to content

Commit

Permalink
Adding bool numpy test.
Browse files Browse the repository at this point in the history
  • Loading branch information
Narsil committed Aug 17, 2023
1 parent 0398834 commit 2b0a49a
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions bindings/python/tests/test_simple.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,19 @@ def test_numpy_example(self):
loaded = load(out)
self.assertTensorEqual(tensors, loaded, np.allclose)

def test_numpy_bool(self):
tensors = {"a": np.asarray(False)}

save_file(tensors, "./out_bool.safetensors")
out = save(tensors)

# Now loading
loaded = load_file("./out_bool.safetensors")
self.assertTensorEqual(tensors, loaded, np.allclose)

loaded = load(out)
self.assertTensorEqual(tensors, loaded, np.allclose)

def test_torch_example(self):
tensors = {
"a": torch.zeros((2, 2)),
Expand Down

0 comments on commit 2b0a49a

Please sign in to comment.