MCPcopy
hub / github.com/tinygrad/tinygrad / test_subbuffer_dealloc

Method test_subbuffer_dealloc

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

Source from the content-addressed store, hash-verified

153 assert self.buf_unalloc.as_memoryview().tolist()[3:7] == sub_buf.as_memoryview().tolist()
154
155 def test_subbuffer_dealloc(self):
156 sub_buf = self.buf.view(4, dtypes.int8, offset=3).ensure_allocated()
157 sub_buf.deallocate()
158 assert self.buf.as_memoryview().tolist() == list(range(10))
159
160 def test_subbuffer_double_dealloc(self):
161 sub_buf = self.buf.view(3, dtypes.uint8, offset=4).ensure_allocated()

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected