MCPcopy
hub / github.com/tinygrad/tinygrad / test_data

Method test_data

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

Source from the content-addressed store, hash-verified

17
18class TestTensorData(unittest.TestCase):
19 def test_data(self):
20 a = Tensor([1,2,3,4], dtype=dtypes.int32)
21 dat = a.data()
22 assert dat.itemsize == 4
23 assert list(dat) == [1,2,3,4]
24 assert dat.shape == (4,)
25 assert dat[0] == 1
26 assert dat[1] == 2
27
28 def test_data_empty(self):
29 a = Tensor([], dtype=dtypes.int32)

Callers

nothing calls this directly

Calls 2

dataMethod · 0.95
TensorClass · 0.90

Tested by

no test coverage detected