def add_scatter(self, name, input_names, output_name, axis=0, mode="UPDATE"):
        """
        Add a scatter layer to the model that scatters data into a new tensor
        according to indices from the input.
        Refer to the ``ScatterLayerParams`` 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
            The axis the operation perform on, default: 0.
        mode: str, optional
            Scatter accumulation mode in [UPDATE | ADD | SUB | MUL | DIV | MAX | MIN], default: UPDATE.

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

        spec_layer = self._add_generic_layer(name, input_names, [output_name])
        spec_layer_params = spec_layer.scatter
        spec_layer_params.axis = axis

        mode = mode.upper() if isinstance(mode, str) else mode
        if mode == "UPDATE":
            spec_layer_params.mode = _proto.NeuralNetwork_pb2.ScatterMode.Value("SCATTER_UPDATE")
        elif mode == "ADD":
            spec_layer_params.mode = _proto.NeuralNetwork_pb2.ScatterMode.Value("SCATTER_ADD")
        elif mode == "SUB":
            spec_layer_params.mode = _proto.NeuralNetwork_pb2.ScatterMode.Value("SCATTER_SUB")
        elif mode == "MUL":
            spec_layer_params.mode = _proto.NeuralNetwork_pb2.ScatterMode.Value("SCATTER_MUL")
        elif mode == "DIV":
            spec_layer_params.mode = _proto.NeuralNetwork_pb2.ScatterMode.Value("SCATTER_DIV")
        elif mode == "MAX":
            spec_layer_params.mode = _proto.NeuralNetwork_pb2.ScatterMode.Value("SCATTER_MAX")
        elif mode == "MIN":
            spec_layer_params.mode = _proto.NeuralNetwork_pb2.ScatterMode.Value("SCATTER_MIN")
        else:
            raise ValueError("Unsupported Scatter mode %s" % mode)

        return spec_layer

        Add a scatter layer to the model that scatters data into a new tensor
        according to indices from the input.
        Refer to the ``ScatterLayerParams`` 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
            The axis the operation perform on, default: 0.
        mode: str, optional
            Scatter accumulation mode in [UPDATE | ADD | SUB | MUL | DIV | MAX | MIN], default: UPDATE.

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