src/graphnet/components/pool.py
def _group_identical(
    tensor: Tensor, batch: Optional[LongTensor] = None
) -> LongTensor:
    """Group rows in `tensor` that are identical

    Args:
        tensor (Tensor): Tensor of shape [N, F]
        batch (Optional[LongTensor], optional): Batch indices, to only group
            identical rows within batches. Defaults to None.

    Returns:
        Tensor: List of group indices, from 0 to num. groups - 1, assigning all
            identical rows to the same group.
    """
    if batch is not None:
        tensor = tensor.cat((tensor, batch.unsqueeze(dim=1)), dim=1)
    return torch.unique(tensor, return_inverse=True, dim=0)[1]
Group rows in `tensor` that are identical

    Args:
        tensor (Tensor): Tensor of shape [N, F]
        batch (Optional[LongTensor], optional): Batch indices, to only group
            identical rows within batches. Defaults to None.

    Returns:
        Tensor: List of group indices, from 0 to num. groups - 1, assigning all
            identical rows to the same group.
    
Group rows in `tensor` that are identical
Group rows in ` tensor ` that are identical
def _group_identical(
    tensor: Tensor, batch: Optional[LongTensor] = None
) -> LongTensor:
    if batch is not None:
        tensor = tensor.cat((tensor, batch.unsqueeze(dim=1)), dim=1)
    return torch.unique(tensor, return_inverse=True, dim=0)[1]
def _group_identical ( tensor : Tensor , batch : Optional [ LongTensor ] = None ) -> LongTensor : if batch is not None : tensor = tensor . cat ( ( tensor , batch . unsqueeze ( dim = 1 ) ) , dim = 1 ) return torch . unique ( tensor , return_inverse = True , dim = 0 ) [ 1 ]
Group rows in `tensor` that are identical
Group rows in ` tensor ` that are identical
"""Group rows in `tensor` that are identical

    Args:
        tensor (Tensor): Tensor of shape [N, F]
        batch (Optional[LongTensor], optional): Batch indices, to only group
            identical rows within batches. Defaults to None.

    Returns:
        Tensor: List of group indices, from 0 to num. groups - 1, assigning all
            identical rows to the same group.
    """
List of group indices, from 0 to num. groups - 1, assigning all
identical rows to the same group.
List of group indices from 0 to num . groups - 1 assigning all identical rows to the same group .
Tensor
tensor
Tensor
Tensor of shape [N, F]
Tensor of shape [ N F ]
batch
Optional[LongTensor]
Batch indices, to only group
identical rows within batches. Defaults to None.
Batch indices to only group identical rows within batches . Defaults to None .