MCPcopy
hub / github.com/tinygrad/tinygrad / test_data_nested

Method test_data_nested

test/unit/test_tensor_data.py:50–58  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

48 assert dat[1] == 2
49
50 def test_data_nested(self):
51 a = Tensor([[1,2],[3,4]], dtype=dtypes.int32)
52 dat = a.data()
53 assert dat.format == "i"
54 assert dat.itemsize == 4
55 assert dat.tolist() == [[1, 2], [3, 4]]
56 assert dat.shape == (2,2)
57 assert dat[0, 0] == 1
58 assert dat[1, 1] == 4
59
60 def test_data_const(self):
61 a = Tensor(3, dtype=dtypes.int32)

Callers

nothing calls this directly

Calls 3

dataMethod · 0.95
TensorClass · 0.90
tolistMethod · 0.45

Tested by

no test coverage detected