def add_padding(
        self,
        name,
        left=0,
        right=0,
        top=0,
        bottom=0,
        value=0,
        input_name="data",
        output_name="out",
        padding_type="constant",
    ):
        """


        Add a padding layer to the model that performs padding along spatial dimensions.

        Refer to the ``PaddingLayerParams`` message in the specification
        (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.
        left: int
            Number of elements to be padded on the left side of the input blob.
        right: int
            Number of elements to be padded on the right side of the input blob.
        top: int
            Number of elements to be padded on the top of the input blob.
        bottom: int
            Number of elements to be padded on the bottom of the input blob.
        value: float
            Value of the elements padded. Used only when ``padding_type = 'constant'``.
        input_name: str
            The input blob name of this layer.
        output_name: str
            The output blob name of this layer.
        padding_type: str
            Type of the padding. Can be one of ``'constant'``, ``'reflection'``, or ``'replication'``.

        See Also
        --------
        add_crop, add_convolution, add_pooling, add_constant_pad
        """
        spec_layer = self._add_generic_layer(name, [input_name], [output_name])
        spec_layer_params = spec_layer.padding

        # Set the parameters
        padding_type = (
            padding_type.lower()
            if isinstance(padding_type, str)
            else padding_type
        )
        if padding_type == "constant":
            spec_layer_params.constant.value = value
        elif padding_type == "reflection":
            spec_layer_params.reflection.MergeFromString(b"")
        elif padding_type == "replication":
            spec_layer_params.replication.MergeFromString(b"")
        else:
            raise ValueError("Unknown padding_type %s" % padding_type)

        height_border = spec_layer_params.paddingAmounts.borderAmounts.add()
        height_border.startEdgeSize = top
        height_border.endEdgeSize = bottom
        width_border = spec_layer_params.paddingAmounts.borderAmounts.add()
        width_border.startEdgeSize = left
        width_border.endEdgeSize = right
        return spec_layer



        Add a padding layer to the model that performs padding along spatial dimensions.

        Refer to the ``PaddingLayerParams`` message in the specification
        (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.
        left: int
            Number of elements to be padded on the left side of the input blob.
        right: int
            Number of elements to be padded on the right side of the input blob.
        top: int
            Number of elements to be padded on the top of the input blob.
        bottom: int
            Number of elements to be padded on the bottom of the input blob.
        value: float
            Value of the elements padded. Used only when ``padding_type = 'constant'``.
        input_name: str
            The input blob name of this layer.
        output_name: str
            The output blob name of this layer.
        padding_type: str
            Type of the padding. Can be one of ``'constant'``, ``'reflection'``, or ``'replication'``.

        See Also
        --------
        add_crop, add_convolution, add_pooling, add_constant_pad
        
coremltools/models/neural_network/builder.py