def add_scale(
        self,
        name,
        W,
        b,
        has_bias,
        input_name,
        output_name,
        shape_scale=None,
        shape_bias=None,
    ):
        """
        Add a scale layer to the model.
        Refer to the ``ScaleLayerParams`` message in the specification
        (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.
        W: int or numpy.array
            Scale of the input.
        b: int or numpy.array
            Bias to add to the input.
        has_bias: boolean
            Whether the bias vector of this layer is ignored in the ``spec``.
        input_name: str
            The input blob name of this layer.
        output_name: str
            The output blob name of this layer.

        shape_scale: list of int or tuple of int
            List of ints that specifies the shape of the scale parameter.
            Can be ``[1]``, ``[C]``, ``[1,H,W]``, or ``[C,H,W]``.
        shape_bias: list of int
            List of ints that specifies the shape of the bias parameter
            (if present). Can be ``[1]``, ``[C]``, ``[1,H,W]``, or ``[C,H,W]``.

        See Also
        --------
        add_bias
        """

        if not shape_scale:
            shape_scale = [1]
        if not shape_bias:
            shape_bias = [1]

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

        spec_layer_params.hasBias = has_bias

        # add scale and its shape
        scale = spec_layer_params.scale
        spec_layer_params.shapeScale.extend(shape_scale)
        if isinstance(W, int):
            scale.floatValue.append(float(W))
        else:
            scale.floatValue.extend(W.flatten())
        if len(scale.floatValue) != _np.prod(shape_scale):
            raise ValueError(
                "Dimensions of 'shape_scale' do not match the size of the provided 'scale' parameter"
            )

        # add bias and its shape
        if has_bias:
            bias = spec_layer_params.bias
            spec_layer_params.shapeBias.extend(shape_bias)
            if isinstance(b, int):
                bias.floatValue.append(float(b))
            else:
                bias.floatValue.extend(b.flatten())
            if len(bias.floatValue) != _np.prod(shape_bias):
                raise ValueError(
                    "Dimensions of 'shape_bias' do not match the size of the provided 'b' parameter"
                )
        return spec_layer

        Add a scale layer to the model.
        Refer to the ``ScaleLayerParams`` message in the specification
        (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.
        W: int or numpy.array
            Scale of the input.
        b: int or numpy.array
            Bias to add to the input.
        has_bias: boolean
            Whether the bias vector of this layer is ignored in the ``spec``.
        input_name: str
            The input blob name of this layer.
        output_name: str
            The output blob name of this layer.

        shape_scale: list of int or tuple of int
            List of ints that specifies the shape of the scale parameter.
            Can be ``[1]``, ``[C]``, ``[1,H,W]``, or ``[C,H,W]``.
        shape_bias: list of int
            List of ints that specifies the shape of the bias parameter
            (if present). Can be ``[1]``, ``[C]``, ``[1,H,W]``, or ``[C,H,W]``.

        See Also
        --------
        add_bias
        
coremltools/models/neural_network/builder.py