MCPcopy
hub / github.com/tinygrad/tinygrad / test_permute_contiguous

Method test_permute_contiguous

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

Source from the content-addressed store, hash-verified

425 self.assertEqual(view.sum().item(), 20)
426
427 def test_permute_contiguous(self):
428 a = torch.tensor([[1, 2], [3, 4]], device=device)
429 b = a.permute(1, 0)
430 c = b.contiguous()
431 expected = [[1, 3], [2, 4]]
432 np.testing.assert_equal(c.cpu().numpy(), expected)
433
434 def test_diag_2d_extract_diagonal(self):
435 a = torch.tensor([[1, 2], [3, 4]], device=device)

Callers

nothing calls this directly

Calls 5

tensorMethod · 0.80
permuteMethod · 0.80
assert_equalMethod · 0.80
contiguousMethod · 0.45
numpyMethod · 0.45

Tested by

no test coverage detected