MCPcopy
hub / github.com/tinygrad/tinygrad / test_subbuffer

Method test_subbuffer

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

Source from the content-addressed store, hash-verified

12 self.buf_unalloc = Buffer(Device.DEFAULT, 10, dtypes.uint8)
13
14 def test_subbuffer(self):
15 vbuf = self.buf.view(2, dtypes.uint8, offset=3).ensure_allocated()
16 tst = vbuf.as_memoryview().tolist()
17 assert tst == [3, 4]
18
19 def test_subbuffer_cast(self):
20 # NOTE: bitcast depends on endianness

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