def add_gather(self, name, input_names, output_name, axis=0):
        """
        Add a gather layer to the model that gathers elements or slices from
        data and store to a tensor whose shape is defined by indices from the
        input.
        Refer to the ``GatherLayerParams`` message in the specification (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.
        input_names: list of str
            The input blob names of this layer.
        output_name: str
            The output blob name of this layer.
        axis: int, optional
            The axis the operation perform on, default: 0.

        See Also
        --------
        add_gather_nd, add_gather_along_axis, add_scatter, add_scatter_nd, add_scatter_along_axis
        """

        spec_layer = self._add_generic_layer(name, input_names, [output_name])
        spec_layer.gather.axis = axis
        self.rank_dict[output_name] = (
            self._get_rank(input_names[0]) - 1 + self._get_rank(input_names[1])
        )
        return spec_layer

        Add a gather layer to the model that gathers elements or slices from
        data and store to a tensor whose shape is defined by indices from the
        input.
        Refer to the ``GatherLayerParams`` message in the specification (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.
        input_names: list of str
            The input blob names of this layer.
        output_name: str
            The output blob name of this layer.
        axis: int, optional
            The axis the operation perform on, default: 0.

        See Also
        --------
        add_gather_nd, add_gather_along_axis, add_scatter, add_scatter_nd, add_scatter_along_axis
        
coremltools/models/neural_network/builder.py