code: def _per_image_random_crop(key, img, cropped_shape):
      """Random crop an image."""
      batch_size, width, height = cropped_shape[:-1]
      key_x, key_y = jax.random.split(key, 2)
      x = jax.random.randint(
          key_x,
          shape=(batch_size,),
          minval=0,
          maxval=img.shape[1] - width,
      )
      y = jax.random.randint(
          key_y,
          shape=(batch_size,),
          minval=0,
          maxval=img.shape[2] - height,
      )
      return _crop_with_indices(img, x, y, cropped_shape)
  
imports: import copy
  import functools
  from absl import logging
  from dopamine.jax import networks
  from dopamine.jax.agents.full_rainbow import full_rainbow_agent
  import gin
  import jax
  import jax.numpy
  import numpy
  import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: _per_image_random_crop(key, img, cropped_shape) and returns: _crop_with_indices