def add_cumsum(
        self, name, input_names, output_name, axis=-1, reverse=False, exclusive=False
    ):
        """
        Add a cum sum layer to the model computes the cumulative sum values of the input along a given axis.
        Refer to the ``CumSumLayerParams`` 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
            Axis to perform the operation, default: -1.
        reverse: bool, optional
            if true, cumsum is performed in the opposite direction, default: False.
        exclusive: bool, optional
            whether to perform exclusive or inclusive cumulative summation, default: False.
        """

        if self.spec and (
            not self.spec.specificationVersion
            or self.spec.specificationVersion < _SPECIFICATION_VERSION_IOS_14
        ):
            self.spec.specificationVersion = _SPECIFICATION_VERSION_IOS_14

        spec_layer = self._add_generic_layer(name, input_names, [output_name])
        spec_layer_params = spec_layer.cumSum
        spec_layer_params.axis = axis
        spec_layer_params.reverse = reverse
        spec_layer_params.excludeFinalSum = exclusive
        return spec_layer

        Add a cum sum layer to the model computes the cumulative sum values of the input along a given axis.
        Refer to the ``CumSumLayerParams`` 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
            Axis to perform the operation, default: -1.
        reverse: bool, optional
            if true, cumsum is performed in the opposite direction, default: False.
        exclusive: bool, optional
            whether to perform exclusive or inclusive cumulative summation, default: False.
        
coremltools/models/neural_network/builder.py