MCPcopy Create free account
hub / github.com/LMCache/LMCache / _alloc_chunks

Function _alloc_chunks

tests/v1/test_python_ops_fallback.py:1833–1837  ·  view source on GitHub ↗
(shape: tuple[int, ...], count: int)

Source from the content-addressed store, hash-verified

1831 use_tensor_list = device not in ("cpu", "cuda")
1832
1833 def _alloc_chunks(shape: tuple[int, ...], count: int) -> list[torch.Tensor]:
1834 chunks = [torch.zeros(shape, dtype=dtype) for _ in range(count)]
1835 if device in ("cuda"):
1836 chunks = [chunk.pin_memory() for chunk in chunks]
1837 return chunks
1838
1839 # --- NHD per-layer ---
1840 torch.manual_seed(123)

Calls

no outgoing calls

Tested by

no test coverage detected