def _try_pure_index_single_axis(
        x: Var, indices_axes: List[int], valid_indices: List[Var], name: str
    ) -> bool:
        """
        Pure index single dimension selection
        Ex:
            a = torch.rand(1,2,3,4)
            index = torch.tensor([0, 1])
            b = a[:,:,:,index]

        In this case, indices is a list [None, None, None, [0, 1]]]. The None element means
        the corresponding dimension is masked. b has shape (1,2,3,2).
        """
        if len(indices_axes) == 1:
            axis = indices_axes[0]
            indices = valid_indices[0]
            if is_current_opset_version_compatible_with(target.iOS17):
                # IOS17 `gather` behaviour is undefined for negative indices.
                indices = mb.cast(x=indices, dtype="int32")
                indices = mb.select(
                    cond=mb.greater_equal(x=indices, y=0),
                    a=indices,
                    b=mb.add(x=indices, y=_utils.pymil_value_at(mb.shape(x=x), axis)),
                )
            # For the single index axis case, we can use mb.gather directly
            x = _utils._construct_gather_op("gather", x, indices, axis, name=name)
            context.add(x)
            return True
        else:
            return False

        Pure index single dimension selection
        Ex:
            a = torch.rand(1,2,3,4)
            index = torch.tensor([0, 1])
            b = a[:,:,:,index]

        In this case, indices is a list [None, None, None, [0, 1]]]. The None element means
        the corresponding dimension is masked. b has shape (1,2,3,2).
        
coremltools/converters/mil/frontend/torch/ops.py