def random_width_inputs(inputs):
            """Inputs width-adjusted with random ops."""
            inputs_shape = tf.shape(inputs)
            img_hd = inputs_shape[-3]
            img_wd = tf.cast(inputs_shape[-2], tf.float32)
            width_factor = backend.random.uniform(
                shape=[],
                minval=(1.0 + self.width_lower),
                maxval=(1.0 + self.width_upper),
                seed=self.seed_generator,
            )
            adjusted_width = tf.cast(width_factor * img_wd, tf.int32)
            adjusted_size = tf.stack([img_hd, adjusted_width])
            output = tf.image.resize(
                images=inputs,
                size=adjusted_size,
                method=self.interpolation,
            )
            # tf.resize will output float32 regardless of input type.
            output = tf.cast(output, self.compute_dtype)
            output_shape = inputs.shape.as_list()
            output_shape[-2] = None
            output.set_shape(output_shape)
            return output
Inputs width-adjusted with random ops.
keras/src/legacy/layers.py