MCPcopy
hub / github.com/tinygrad/tinygrad / test_as_strided

Method test_as_strided

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

Source from the content-addressed store, hash-verified

66 np.testing.assert_equal(a[1:].cpu().numpy(), [2,3,4])
67
68 def test_as_strided(self):
69 a = torch.arange(70, device=device).reshape(1,1,10,7)
70 a = a.as_strided((1,1,10,5), (0,0,7,1), storage_offset=0)
71 a = a.as_strided((1,1,5,5), (50,50,7,1), storage_offset=21)
72 np.testing.assert_equal(a.cpu().numpy().sum(-1), [[[115,150,185,220,255]]])
73
74 def test_plus_inplace(self):
75 a = torch.ones(4, device=device)

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected