def add_elementwise(self, name, input_names, output_name, mode, alpha=None):
        """
        Add an element-wise operation layer to the model.
        Refer to the specification (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.
        input_names: list of str
            A list of input blob names of this layer. The input blobs should have the same shape.
        output_name: str
            The output blob name of this layer.
        mode: str
            A string specifying the mode of the elementwise layer. It can be one of the following:

            - ``'CONCAT'``: Concatenate input blobs along the channel axis.
            - ``'SEQUENCE_CONCAT'``: Concatenate input blobs along the sequence axis.
            - ``'ADD'``: Perform an element-wise summation over the input blobs.
            - ``'MULTIPLY'``: Perform an element-wise multiplication over the input blobs.
            - ``'DOT'``: Compute the dot product of the two input blobs.
              In this mode, the length of ``input_names`` should be 2.
            - ``'COS'``: Compute the cosine similarity of the two input blobs.
              In this mode, the length of ``input_names`` should be 2.
            - ``'MAX'``: Compute the element-wise maximum over the input blobs.
            - ```'MIN'```: Compute the element-wise minimum over the input blobs.
            - ``'AVE'``: Compute the element-wise average over the input blobs.

        alpha: float
            * if ``mode == 'ADD'`` and there is only one ``input_name``,
              ``alpha`` is added to the input.
            * if ``mode == 'MULTIPLY'`` and there is only one ``input_name``,
              ``alpha`` is multiplied to the input.

        See Also
        --------
        add_upsample, add_sequence_repeat

        """
        input_names = input_names if isinstance(input_names, list) else [input_names]
        spec_layer = self._add_generic_layer(name, input_names, [output_name])

        # add one of the following layers
        mode = mode.upper() if isinstance(mode, str) else mode
        if mode == "CONCAT":
            spec_layer.concat.sequenceConcat = False
        elif mode == "SEQUENCE_CONCAT":
            spec_layer.concat.sequenceConcat = True
        elif mode == "ADD":
            spec_layer.add.MergeFromString(b"")
            if alpha:
                spec_layer.add.alpha = alpha
        elif mode == "MULTIPLY":
            spec_layer.multiply.MergeFromString(b"")
            if alpha:
                spec_layer.multiply.alpha = alpha
        elif mode == "COS":
            spec_layer.dot.cosineSimilarity = True
        elif mode == "DOT":
            spec_layer.dot.cosineSimilarity = False
        elif mode == "MAX":
            spec_layer.max.MergeFromString(b"")
        elif mode == "MIN":
            spec_layer.min.MergeFromString(b"")
        elif mode == "AVE":
            spec_layer.average.MergeFromString(b"")
        else:
            raise ValueError("Unsupported elementwise mode %s" % mode)
        return spec_layer

        Add an element-wise operation layer to the model.
        Refer to the specification (NeuralNetwork.proto) for more details.

        Parameters
        ----------
        name: str
            The name of this layer.
        input_names: list of str
            A list of input blob names of this layer. The input blobs should have the same shape.
        output_name: str
            The output blob name of this layer.
        mode: str
            A string specifying the mode of the elementwise layer. It can be one of the following:

            - ``'CONCAT'``: Concatenate input blobs along the channel axis.
            - ``'SEQUENCE_CONCAT'``: Concatenate input blobs along the sequence axis.
            - ``'ADD'``: Perform an element-wise summation over the input blobs.
            - ``'MULTIPLY'``: Perform an element-wise multiplication over the input blobs.
            - ``'DOT'``: Compute the dot product of the two input blobs.
              In this mode, the length of ``input_names`` should be 2.
            - ``'COS'``: Compute the cosine similarity of the two input blobs.
              In this mode, the length of ``input_names`` should be 2.
            - ``'MAX'``: Compute the element-wise maximum over the input blobs.
            - ```'MIN'```: Compute the element-wise minimum over the input blobs.
            - ``'AVE'``: Compute the element-wise average over the input blobs.

        alpha: float
            * if ``mode == 'ADD'`` and there is only one ``input_name``,
              ``alpha`` is added to the input.
            * if ``mode == 'MULTIPLY'`` and there is only one ``input_name``,
              ``alpha`` is multiplied to the input.

        See Also
        --------
        add_upsample, add_sequence_repeat

        
coremltools/models/neural_network/builder.py