code: def _decode_and_random_crop(image_bytes: tf.Tensor) -> tf.Tensor:
      """Make a random crop of image."""
      jpeg_shape = tf.image.extract_jpeg_shape(image_bytes)
      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,
          jpeg_shape=jpeg_shape,
          bbox=bbox,
          min_object_covered=0.1,
          aspect_ratio_range=(3 / 4, 4 / 3),
          area_range=(0.08, 1.0),
          max_attempts=10,
      )
      if tf.reduce_all(tf.equal(jpeg_shape, tf.shape(image))):
          # If the random crop failed fall back to center crop.
          image = _decode_and_center_crop(image_bytes, jpeg_shape)
      return image
  
file_path: objax/examples/image_classification/imagenet_resnet50_data.py
imports: import enum
  from typing import Optional, Sequence, Tuple
  import jax
  import numpy
  import tensorflow.compat.v2
  import tensorflow_datasets
label_desc: Use image node_id 8 for calling a global function with example usage: _decode_and_random_crop(image_bytes) and returns: image