def METHOD_NAME(
    self,
    images,
    interpolate=False,
    interpolate_width=None,
    interpolate_height=None,
    patch_size=None,
):
    """Calls the PatchingAndEmbedding layer on a batch of images.
    Args:
        images: A `tf.Tensor` of shape [batch, width, height, depth]
        interpolate: A `bool` to enable or disable interpolation
        interpolate_height: An `int` representing interpolated height
        interpolate_width: An `int` representing interpolated width
        patch_size: An `int` representing the new patch size if
            interpolation is used
    Returns:
        `A tf.Tensor` of shape [batch, patch_num+1, embedding_dim]
    """
    # Turn images into patches and project them onto `project_dim`
    patches = self.projection(images)
    patch_shapes = tf.shape(patches)
    patches_flattened = tf.reshape(
        patches,
        shape=(
            patch_shapes[0],
            patch_shapes[-2] * patch_shapes[-2],
            patch_shapes[-1],
        ),
    )
    # Add learnable class token before linear projection and positional
    # embedding
    flattened_shapes = tf.shape(patches_flattened)
    class_token_broadcast = tf.cast(
        tf.broadcast_to(
            self.class_token,
            [flattened_shapes[0], 1, flattened_shapes[-1]],
        ),
        dtype=patches_flattened.dtype,
    )
    patches_flattened = tf.concat(
        [class_token_broadcast, patches_flattened], 1
    )
    positions = tf.range(start=0, limit=self.num_patches + 1, delta=1)
    if interpolate and None not in (
        interpolate_width,
        interpolate_height,
        patch_size,
    ):
        (
            interpolated_embeddings,
            class_token,
        ) = self.__interpolate_positional_embeddings(
            self.position_embedding(positions),
            interpolate_width,
            interpolate_height,
            patch_size,
        )
        addition = patches_flattened + interpolated_embeddings
        encoded = tf.concat([class_token, addition], 1)
    elif interpolate and None in (
        interpolate_width,
        interpolate_height,
        patch_size,
    ):
        raise ValueError(
            "`None of `interpolate_width`, `interpolate_height` and "
            "`patch_size` cannot be None if `interpolate` is True"
        )
    else:
        encoded = patches_flattened + self.position_embedding(positions)
    return encoded