code: def deterministic_crop(images, size, spatial_idx):
      """Takes a deterministic crop of input images.
  
      Args:
        images: `Tensor` of shape shape [t, h, w, c]
        size: Integer ; size of height and width to crop the images.
        spatial_idx: 0, 1, or 2 for left, center, and right crop if width is larger
          than height. Or 0, 1, or 2 for top, center, and bottom crop if height is
          larger than width.
  
      Returns:
        cropped: `Tensor` of shape [t, crop_size, crop_size, c]
      """
      assert spatial_idx in [0, 1, 2]
      height, width = tf.shape(images)[1], tf.shape(images)[2]
  
      y_offset = tf.cast(tf.math.ceil((height - size) / 2), tf.int32)
      x_offset = tf.cast(tf.math.ceil((width - size) / 2), tf.int32)
  
      if height > width:
          if spatial_idx == 0:
              y_offset = 0
          elif spatial_idx == 2:
              y_offset = height - size
      else:
          if spatial_idx == 0:
              x_offset = 0
          elif spatial_idx == 2:
              x_offset = width - size
  
      cropped = tf.slice(
          images, [0, y_offset, x_offset, 0], [-1, size, size, -1]
      )
  
      return cropped
  
imports: import functools
  import math
  from typing import Optional
  from absl import logging
  from dmvr import builders
  from dmvr import processors
  import simclr.tf2.data_util
  import tensorflow
  from official.vision.image_classification import augment
label_desc: Use image node_id 10 for calling a global function with example usage: deterministic_crop(images, size, spatial_idx) and returns: cropped