View source on GitHub |
Concatenates a list of inputs.
Inherits From: Layer
, Operation
tf.keras.layers.Concatenate(
axis=-1, **kwargs
)
Used in the notebooks
Used in the guide | Used in the tutorials |
---|---|
It takes as input a list of tensors, all of the same shape except for the concatenation axis, and returns a single tensor that is the concatenation of all inputs.
Examples:
x = np.arange(20).reshape(2, 2, 5)
y = np.arange(20, 30).reshape(2, 1, 5)
keras.layers.Concatenate(axis=1)([x, y])
Usage in a Keras model:
x1 = keras.layers.Dense(8)(np.arange(10).reshape(5, 2))
x2 = keras.layers.Dense(8)(np.arange(10, 20).reshape(5, 2))
y = keras.layers.Concatenate()([x1, x2])
Args | |
---|---|
axis
|
Axis along which to concatenate. |
**kwargs
|
Standard layer keyword arguments. |
Returns | |
---|---|
A tensor, the concatenation of the inputs alongside axis axis .
|
Methods
from_config
@classmethod
from_config( config )
Creates a layer from its config.
This method is the reverse of get_config
,
capable of instantiating the same layer from the config
dictionary. It does not handle layer connectivity
(handled by Network), nor weights (handled by set_weights
).
Args | |
---|---|
config
|
A Python dictionary, typically the output of get_config. |
Returns | |
---|---|
A layer instance. |
symbolic_call
symbolic_call(
*args, **kwargs
)