I would like to use the Keras layer:
from keras.layers.convolutional import UpSampling2D
x = UpSampling2D((2, 2))(x)
How can I replicate this behavior with native tensorflow ?
I can't manage to find an equivalent function/layer.
Assuming x
is of shape (BATCH_SIZE, H, W, C)
, you can use tf.image.resize_nearest_neighbor
, which is the backend implementation used by keras:
x = tf.image.resize_nearest_neighbor(x, (2*H,2*W))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With