Keras Merge Layers
Add
This layer adds a list of inputs by taking a similar shape of the tensors list as an input and returns a single tensor of the same shape.
Example
Subtract
This layer is used for subtracting two inputs by taking tensors list of size 2 as an input while mandating their shape to be similar and outputs a single tensor (inputs[0] – inputs[1]), that too of same shape.
Examples
Multiply
It is the layer that performs element-wise multiplication operation on a list of inputs by taking the similar shape of the tensors list as an input and returns an individual tensor of the same shape.
Average
This layer computes the average of a list of inputs by taking the similar shape of the tensors list and returns the same shape of the single tensor.
Maximum
This layer calculates the maximum of the inputs list (element-wise) by taking the similar shape of the tensors list and returns the same shape of the single tensor.
Minimum
This layer calculates the minimum of inputs list (element-wise) by taking the similar shape of the tensors list and returns the same shape of the single tensor.
Concatenate
This layer is used to concatenate the inputs list by taking a similar shape of tensors list except for the concatenation axis and returns the same shape of a single tensor, which is actually the concatenation of all inputs.
Arguments
- axis: The term axis represents the axis along which it has to be concatenated.
- **kwargs: It indicates a standardized keyword argument for a layer.
Dot
This is the layer that is used to calculate the dot product among the samples present in two tensors. To understand it more briefly, let’s have a look at an example; suppose if we apply it to a list of any two tensors, i.e., q and r having a shape (batch_size, n), then, in that case, the output shape of the tensor will be (batch_size, 1), such that each entry i will relate to the dot product between q[i] and r[i].
Arguments
- axis: The term axis is also called axes, represents the axis along which the dot product has to be computed and may either be an integer or a tuple of integers.
- Normalize: It represents a situation, if to L2- normalizes the samples alongside the axis of dot product before it is evaluated. The computed output of the dot product is said to be the cosine proximity in between any two samples, only if it is set to True.
- **kwargs: It indicates a standardized keyword argument for a layer.
add
It can be defined as a functional interface to the Add layer.
Arguments
- inputs: It can be defined as an input tensor list that should be at least 2.
- **kwargs: It indicates a standardized keyword argument for a layer.
Returns
It returns a tensor that encompasses the calculated sum after the addition of inputs.
Example
subtract
It can be defined as a functional interface to the Subtract layer.
Arguments
- inputs: It can be defined as an input tensor list that should be at least 2.
- **kwargs: It indicates a standardized keyword argument for a layer.
Returns
It returns a tensor that encompasses the computed difference after the subtraction of inputs.
Example
multiply
It can be defined as a functional interface to the Multiply layer.
Arguments
- inputs: It can be defined as an input tensor list that should be at least 2.
- **kwargs: It indicates a standardized keyword argument for a layer.
Returns
It returns a tensor, which is the element-wise computed product of inputs.
average
It can be defined as a functional interface to the Average layer.
Arguments
- inputs: It can be defined as an input tensor list that should be at least 2.
- **kwargs: It indicates a standardized keyword argument for a layer.
Returns
It returns a tensor, which is the computed average of inputs.
maximum
It can be defined as a functional interface to the Maximum layer.
Arguments
- inputs: It can be defined as an input tensor list that should be at least 2.
- **kwargs: It indicates a standardized keyword argument for a layer.
Returns
It returns a tensor, which is the element-wise computed maximum of inputs.
minimum
It can be defined as a functional interface to the Minimum layer.
Arguments
- inputs: It can be defined as an input tensor list that should be at least 2.
- **kwargs: It indicates a standardized keyword argument for a layer.
Returns
It returns a tensor, which is the element-wise computed minimum of inputs.
concatenate
It can be defined as a functional interface to the Concatenate layer.
Arguments
- inputs: It can be defined as an input tensor list that should be at least 2.
- axis: The term axis represents the axis along which it has to be concatenated.
- **kwargs: It indicates a standardized keyword argument for a layer.
Returns
It returns a tensor that encompasses the concatenation of inputs along the axis.
dot
It can be defined as a functional interface to the Dot layer.
Arguments
- inputs: It can be defined as an input tensor list that should be at least 2.
- axis: The term axis represents the axis along which it has to be concatenated.
- normalize: It represents a situation, if to L2- normalizes the samples alongside the axis of dot product before it is evaluated. The computed output of the dot product is said to be the cosine proximity in between any two samples, only if it is set to True.
- **kwargs: It indicates a standardized keyword argument for a layer.
Returns
It returns a tensor that encompasses the dot product after multiplying the samples of inputs.