import torch


def gather_feat(feat: torch.Tensor, indices: torch.Tensor) -> torch.Tensor:
    """Gathers values specified by `indices` along dim=1.

    Args:
        feat (torch.Tensor): The source tensor containing the features of
            interest.
        indices (torch.Tensor): The indices of elements to gather.

    Returns:
        (torch.Tensor): The gathered features.
    """
    dim = feat.size(2)
    indices = indices.unsqueeze(2).expand(indices.size(0), indices.size(1), dim)
    feat = feat.gather(1, indices)
    return feat