def add_bias(self, name, b, input_name, output_name, shape_bias=None):
        """
        Add a bias layer to the model.
        Refer to the ``BiasLayerParams`` message in the specification
        (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.
        b: int or numpy.array
            Bias to add to the input.
        input_name: str
            The input blob name of this layer.
        output_name: str
            The output blob name of this layer.
        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_scale
        """

        if not shape_bias:
            shape_bias = [1]

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

        # add bias and its shape
        bias = spec_layer_params.bias
        if len(shape_bias) != 1 and len(shape_bias) != 3:
            raise ValueError("Shape of bias layer must have length 1 or 3.")

        spec_layer_params.shape.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 bias layer to the model.
        Refer to the ``BiasLayerParams`` message in the specification
        (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.
        b: int or numpy.array
            Bias to add to the input.
        input_name: str
            The input blob name of this layer.
        output_name: str
            The output blob name of this layer.
        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_scale
        
coremltools/models/neural_network/builder.py