MCPcopy
hub / github.com/tinygrad/tinygrad / test_expand

Method test_expand

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

Source from the content-addressed store, hash-verified

37 np.testing.assert_equal(c.cpu().numpy(), [2,2,2,2])
38
39 def test_expand(self):
40 a = torch.Tensor([1,2,3,4]).to(device)
41 out = a.reshape(4,1).expand(4,4)
42 np.testing.assert_equal(out.cpu().numpy(), [[1,1,1,1],[2,2,2,2],[3,3,3,3],[4,4,4,4]])
43
44 def test_reshape(self):
45 a = torch.Tensor([[1,2],[3,4]]).to(device)

Callers

nothing calls this directly

Calls 5

expandMethod · 0.80
reshapeMethod · 0.80
assert_equalMethod · 0.80
toMethod · 0.45
numpyMethod · 0.45

Tested by

no test coverage detected