Commit 83b667ef authored by rusty1s's avatar rusty1s
Browse files

allclose

parent 20a7cd3c
...@@ -15,5 +15,6 @@ def test_std(dtype, device, bias): ...@@ -15,5 +15,6 @@ def test_std(dtype, device, bias):
index = tensor([[0, 0, 0, 0, 0], [1, 1, 1, 1, 1]], torch.long, device) index = tensor([[0, 0, 0, 0, 0], [1, 1, 1, 1, 1]], torch.long, device)
out = scatter_std(src, index, dim=-1, unbiased=bias) out = scatter_std(src, index, dim=-1, unbiased=bias)
expected = src.std(dim=-1, unbiased=bias) std = src.std(dim=-1, unbiased=bias)[0].item()
assert out.tolist() == [[expected[0].item(), 0], [0, expected[0].item()]] expected = torch.tensor([[std, 0], [0, std]], dtype=out.dtype)
assert torch.allclose(out, expected)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment