def add_one_hot(
        self,
        name,
        input_names,
        output_name,
        one_hot_vector_size=None,
        axis=-1,
        on_value=1.0,
        off_value=0.0,
    ):
        """
        Add a one hot layer to the model that computes the one hot representation of the input tensor.
        Refer to the ``OneHotLayerParams`` 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.
        one_hot_vector_size:  int > 0
            size of the one hot vector.
        axis: int, optional
            refers to the axis in the output tensor, default: -1.
        on_value: float, optional
            Constant value on locations represented by first input, default: 1.0.
        off_value: float, optional
            Constant value at all other locations, default: 0.0.
        """

        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.oneHot
        spec_layer_params.axis = axis
        if one_hot_vector_size:
            spec_layer_params.oneHotVectorSize = one_hot_vector_size
        spec_layer_params.onValue = on_value
        spec_layer_params.offValue = off_value
        return spec_layer

        Add a one hot layer to the model that computes the one hot representation of the input tensor.
        Refer to the ``OneHotLayerParams`` 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.
        one_hot_vector_size:  int > 0
            size of the one hot vector.
        axis: int, optional
            refers to the axis in the output tensor, default: -1.
        on_value: float, optional
            Constant value on locations represented by first input, default: 1.0.
        off_value: float, optional
            Constant value at all other locations, default: 0.0.
        
coremltools/models/neural_network/builder.py