MCPcopy
hub / github.com/tinygrad/tinygrad / test_subbuffer_double

Method test_subbuffer_double

test/backend/test_subbuffer.py:25–29  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

23 assert tst == [3|(4<<8), 5|(6<<8)]
24
25 def test_subbuffer_double(self):
26 vbuf = self.buf.view(4, dtypes.uint8, offset=3).ensure_allocated()
27 vvbuf = vbuf.view(2, dtypes.uint8, offset=1).ensure_allocated()
28 tst = vvbuf.as_memoryview().tolist()
29 assert tst == [4, 5]
30
31 def test_subbuffer_len(self):
32 vbuf = self.buf.view(5, dtypes.uint8, 2).ensure_allocated()

Callers

nothing calls this directly

Calls 4

ensure_allocatedMethod · 0.80
as_memoryviewMethod · 0.80
viewMethod · 0.45
tolistMethod · 0.45

Tested by

no test coverage detected