(tensor: Optional[torch.Tensor])
| 121 | |
| 122 | |
| 123 | def _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 | |
| 133 | def _layer_length(tensor: Optional[torch.Tensor]) -> int: |
no outgoing calls
no test coverage detected