MCPcopy Create free account
hub / github.com/pytorch/executorch / _allocate_buf

Function _allocate_buf

exir/memory_planning.py:1136–1141  ·  view source on GitHub ↗
(bufsizes: List[int], mem_id: int, allocated: int)

Source from the content-addressed store, hash-verified

1134 # allocate 'allocated' bytes from buffer with id mem_id.
1135 # return the starting offset of the allocated buffer.
1136 def _allocate_buf(bufsizes: List[int], mem_id: int, allocated: int) -> int:
1137 if mem_id >= len(bufsizes):
1138 bufsizes.extend([0] * (mem_id - len(bufsizes) + 1))
1139 ret = bufsizes[mem_id]
1140 bufsizes[mem_id] += allocated
1141 return ret
1142
1143 bufsizes = getattr(graph_module, "input_mem_buffer_sizes", None)
1144 if bufsizes is None:

Callers 1

naiveFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected