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

Function _layer_is_empty

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

Source from the content-addressed store, hash-verified

121
122
123def _layer_is_empty(tensor: Optional[torch.Tensor]) -> bool:
124 if tensor is None:
125 return True
126 if isinstance(tensor, list):
127 return len(tensor) == 0
128 if isinstance(tensor, torch.Tensor):
129 return tensor.numel() == 0 or tensor.shape[-2] == 0
130 return False
131
132
133def _layer_length(tensor: Optional[torch.Tensor]) -> int:

Callers 4

_safe_seq_lenFunction · 0.85
_slice_inplaceFunction · 0.85
_select_indicesFunction · 0.85
_elementwise_binary_opFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected