Complex Upsampling 2D¶
-
class
ComplexUpSampling2D
¶ Upsampling layer for 2D inputs.
The algorithms available are nearest neighbor or bilinear.
Usage example
import tensorflow as tf
from cvnn.layers import ComplexUnPooling2D
x = tf.convert_to_tensor([[[[1., 2.], [3., 4.]]]])
z = tf.complex(real=x, imag=x)
y_tf = tf.keras.layers.UpSampling2D(size=2, interpolation='bilinear', data_format='channels_first')(x)
y_cvnn = ComplexUpSampling2D(size=2, interpolation='bilinear', data_format='channels_first')(z)
assert np.all(y_tf == tf.math.real(y_cvnn).numpy())
-
__init__
(self, size=(2, 2), data_format: Optional[str] = None, interpolation: str = 'nearest', dtype=DEFAULT_COMPLEX_TYPE, **kwargs)¶ Parameters: - size – Int, or tuple of 2 integers. The upsampling factors for rows and columns.
- data_format – string, one of
channels_last
(default) orchannels_first
. The ordering of the dimensions in the inputs.channels_last
corresponds to inputs with shape(batch_size, height, width, channels)
whilechannels_first
corresponds to inputs with shape(batch_size, channels, height, width)
. - interpolation – A string, one of
nearest
orbilinear
.