code: def _decode_and_center_crop(image_bytes, image_size):
      """Crops to center of image with padding then scales `image_size`."""
      shape = tf.image.extract_jpeg_shape(image_bytes)
      image_height = shape[0]
      image_width = shape[1]
  
      padded_center_crop_size = tf.cast(
          (
              (image_size / (image_size + CROP_PADDING))
              * tf.cast(
                  tf.minimum(image_height, image_width), tf.float32
              )
          ),
          tf.int32,
      )
  
      offset_height = (
          (image_height - padded_center_crop_size) + 1
      ) // 2
      offset_width = ((image_width - padded_center_crop_size) + 1) // 2
      crop_window = tf.stack(
          [
              offset_height,
              offset_width,
              padded_center_crop_size,
              padded_center_crop_size,
          ]
      )
      image = tf.image.decode_and_crop_jpeg(
          image_bytes, crop_window, channels=3
      )
      image = _resize(image, image_size)
  
      return image
  
file_path: scenic/scenic/dataset_lib/imagenet_dataset.py
imports: import functools
  from typing import Optional
  from absl import logging
  from flax import jax_utils
  import jax
  import jax.numpy
  from scenic.dataset_lib import dataset_utils
  from scenic.dataset_lib import datasets
  import tensorflow
  import tensorflow_datasets
label_desc: Use image node_id 5 for calling a global function with example usage: _decode_and_center_crop(image_bytes, image_size) and returns: image