MCPcopy
hub / github.com/tinygrad/tinygrad / test_chained_slice_column

Method test_chained_slice_column

extra/torch_backend/test.py:450–454  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

448 np.testing.assert_equal(a.cpu().numpy(), [3, 6, 6, 8])
449
450 def test_chained_slice_column(self):
451 a = torch.arange(16, dtype=torch.float32, device=device).reshape(4, 4)
452 torch_res = a[:, 1:2][:, 0:1].cpu().numpy()
453 cpu_res = torch.arange(16, dtype=torch.float32).reshape(4, 4)[:, 1:2][:, 0:1].numpy()
454 np.testing.assert_equal(torch_res, cpu_res)
455
456 def test_slice_with_step(self):
457 a = torch.arange(20, dtype=torch.float32, device=device)

Callers

nothing calls this directly

Calls 4

reshapeMethod · 0.80
arangeMethod · 0.80
assert_equalMethod · 0.80
numpyMethod · 0.45

Tested by

no test coverage detected