<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def add_elementwise(self, name, input_names, output_name, mode, alpha = None):
 """ Add an element-wise operation layer to the model. Parameters The name of this layer name: str input_names: [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 """

        spec = self.spec
        nn_spec = self.nn_spec

        spec_layer = nn_spec.layers.add()
        spec_layer.name = name

        if isinstance(input_names, list):
            for input_name in input_names:
                spec_layer.input.append(input_name)
        else:
            spec_layer.input.append(input_names)
        spec_layer.output.append(output_name)

        ## Add the following layers.
        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)