code: def _decode_and_random_crop(image_bytes, image_size):
      """Make a random crop of `image_size`."""
      bbox = tf.constant(
          [0.0, 0.0, 1.0, 1.0], dtype=tf.float32, shape=[1, 1, 4]
      )
      image = distorted_bounding_box_crop(
          image_bytes,
          bbox,
          min_object_covered=0.1,
          aspect_ratio_range=(3.0 / 4, 4.0 / 3.0),
          area_range=(0.08, 1.0),
          max_attempts=10,
      )
      original_shape = tf.image.extract_jpeg_shape(image_bytes)
      bad = _at_least_x_are_equal(original_shape, tf.shape(image), 3)
  
      image = tf.cond(
          bad,
          lambda: _decode_and_center_crop(image_bytes, image_size),
          lambda: _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 4 for calling a global function with example usage: _decode_and_random_crop(image_bytes, image_size) and returns: image