View source on GitHub
|
Upsampling layer for 2D inputs.
Inherits From: Layer, Operation
tf.keras.layers.UpSampling2D(
size=(2, 2), data_format=None, interpolation='nearest', **kwargs
)
The implementation uses interpolative resizing, given the resize method
(specified by the interpolation argument). Use interpolation=nearest
to repeat the rows and columns of the data.
Example:
input_shape = (2, 2, 1, 3)x = np.arange(np.prod(input_shape)).reshape(input_shape)print(x)[[[[ 0 1 2]][[ 3 4 5]]][[[ 6 7 8]][[ 9 10 11]]]]y = keras.layers.UpSampling2D(size=(1, 2))(x)print(y)[[[[ 0 1 2][ 0 1 2]][[ 3 4 5][ 3 4 5]]][[[ 6 7 8][ 6 7 8]][[ 9 10 11][ 9 10 11]]]]
Input shape | |
|---|---|
4D tensor with shape:
|
Output shape | |
|---|---|
4D tensor with shape:
|
Methods
from_config
@classmethodfrom_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
)
View source on GitHub