MCPcopy Create free account
hub / github.com/FastMAS/KVCOMM / _empty_like_tensor

Function _empty_like_tensor

KVCOMM/llm/kvcomm_engine.py:179–182  ·  view source on GitHub ↗
(tensor: Optional[torch.Tensor])

Source from the content-addressed store, hash-verified

177
178
179def _empty_like_tensor(tensor: Optional[torch.Tensor]) -> Optional[torch.Tensor]:
180 if tensor is None or isinstance(tensor, list):
181 return tensor
182 return tensor[..., :0, :].clone()
183
184
185def _ensure_same_layout(cache: DynamicCache, other: DynamicCache) -> None:

Callers 1

_slice_inplaceFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected