def add_branch(self, name, input_name, if_branch=None, else_branch=None):
        """
        Add a branch layer to the model that provides the functionality of
        branching or an ``if-else`` block.
        Refer to the ``BranchLayerParams`` 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.
        if_branch: NeuralNetwork
            Neural network to execute if the absolute value of the input tensor is greater than 1e-6.
        else_branch: NeuralNetwork, optional
            Neural network to execute if the absolute value of the input tensor is less than 1e-6.

        See Also
        --------
        add_loop, add_loop_continue, add_loop_break
        """

        layer = self._add_generic_layer(name, [input_name], [])
        branch = layer.branch
        if if_branch:
            branch.ifBranch = if_branch
        else:
            branch.ifBranch.MergeFromString(b"")
        if else_branch:
            branch.elseBranch = else_branch
        else:
            branch.elseBranch.MergeFromString(b"")
        return layer

        Add a branch layer to the model that provides the functionality of
        branching or an ``if-else`` block.
        Refer to the ``BranchLayerParams`` 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.
        if_branch: NeuralNetwork
            Neural network to execute if the absolute value of the input tensor is greater than 1e-6.
        else_branch: NeuralNetwork, optional
            Neural network to execute if the absolute value of the input tensor is less than 1e-6.

        See Also
        --------
        add_loop, add_loop_continue, add_loop_break
        
coremltools/models/neural_network/builder.py