import tensorflow as tf import keras from keras.src import ops

keras.backend.set_image_data_format('channels_first')

x = tf.zeros((3, 12, 224, 224))

output_upsampling_layer = keras.layers.UpSampling2D(size=(2, 2), interpolation="bilinear")(x) output_bilinear_resize_only = ops.image.resize(x, (448, 448), interpolation="bilinear")

results in: output_upsampling_layer shape: (3, 448, 224, 448) output_bilinear_resize_only shape (3, 12, 448, 448)

Comment From: tristandb8

To my understanding, the problem is that keras is still set to channels_first when x = ops.image.resize(x, new_shape, interpolation=interpolation) is called, but you transposed it to channels_last before calling that line