def add_categorical_distribution(
        self,
        name,
        input_name,
        output_name,
        num_samples,
        is_logits=True,
        eps=1e-10,
        temperature=1.0,
        seed=-1,
    ):
        """
        Add a categorical_distribution layer to the model that fills the output
        tensor with random values from categorical distribution.
        Refer to the ``CategoricalDistributionLayerParams`` message in the specification
        (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.
        input_name: str
            The input blob name of this layer.
        output_name: str
            The output blob name of this layer.
        num_samples: int
            List of dimensions for the reduce operations.
        is_logits: bool, optional
            If true, the input is log probabilities. If false, the input is
            probabilities, default: True
        eps: float, optional
            Epsilon parameter for categorical distribution, default 1e-10.
        temperature: float, optional
            Temperature parameter for categorical distribution, default 1.0.
        seed: int, optional
            Used to create a random seed for the distribution. default -1 (random).
        """

        spec_layer = self._add_generic_layer(name, [input_name], [output_name])
        spec_layer_params = spec_layer.categoricalDistribution

        spec_layer_params.numSamples = num_samples
        spec_layer_params.isLogits = is_logits
        spec_layer_params.eps = eps
        spec_layer_params.temperature = temperature
        spec_layer_params.seed = seed

        return spec_layer

        Add a categorical_distribution layer to the model that fills the output
        tensor with random values from categorical distribution.
        Refer to the ``CategoricalDistributionLayerParams`` message in the specification
        (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.
        input_name: str
            The input blob name of this layer.
        output_name: str
            The output blob name of this layer.
        num_samples: int
            List of dimensions for the reduce operations.
        is_logits: bool, optional
            If true, the input is log probabilities. If false, the input is
            probabilities, default: True
        eps: float, optional
            Epsilon parameter for categorical distribution, default 1e-10.
        temperature: float, optional
            Temperature parameter for categorical distribution, default 1.0.
        seed: int, optional
            Used to create a random seed for the distribution. default -1 (random).
        
coremltools/models/neural_network/builder.py