def _try_single_bool_index(x: Var, indices: List[Var], name: str) -> bool:
        """
        A single boolean index selection
        Ex:
            a = torch.rand(2, 3, 4)
            b = torch.rand(3, 4)
            index = b > 0.1
            c = a[:, b]

            For this case, the only non-None tensor is with dtype bool
            The true value indicates whether the element should be selected among the masked axes
            The output c is a tensor with shape (2, N), where N is the number of elements of b satisfying condition > 0.1
        """
        boolean_indices_axis = []
        for i, index in enumerate(indices):
            if index is not None and types.is_bool(index.dtype):
                boolean_indices_axis.append(i)

        if len(boolean_indices_axis) == 1:
            # get the True element indices
            axis = boolean_indices_axis[0]
            axes = list(range(axis, axis + index.rank))
            index = indices[axis]
            index = mb.non_zero(x=index)

            # transpose the masked axes to the beginning
            perm = axes + [i for i in range(x.rank) if i not in axes]
            x = mb.transpose(x=x, perm=perm)
            x = _utils._construct_gather_op("gather_nd", x, index)

            # transpose the tensor back
            perm_back = list(range(1, x.rank))
            perm_back.insert(axis, 0)
            res = mb.transpose(x=x, perm=perm_back, name=name)
            context.add(res)

            return True
        else:
            return False

        A single boolean index selection
        Ex:
            a = torch.rand(2, 3, 4)
            b = torch.rand(3, 4)
            index = b > 0.1
            c = a[:, b]

            For this case, the only non-None tensor is with dtype bool
            The true value indicates whether the element should be selected among the masked axes
            The output c is a tensor with shape (2, N), where N is the number of elements of b satisfying condition > 0.1
        
coremltools/converters/mil/frontend/torch/ops.py