code: def get_padding_params_from_crop_slice(
      begin: tf.Tensor, size: tf.Tensor
  ) -> Tuple[tf.Tensor, tf.Tensor, tf.Tensor, tf.Tensor]:
      """Computes padding parameters for (possibly out of bounds) crop slice.
  
      Given a crop slice that potentially falls outside of the image, calculates
      offset and size for the two spatial dimensions.
  
      Args:
        begin: Beginning of the slice. Assumed to have 3 elements (W, H, C) with
          the channel slice starting at 0.
        size: Size of the slice. Assumed to have 3 elemets (W, H, C) with the
          channel slice covering the entire shape (i.e. equal to -1).
  
      Returns:
        Offset and size for height and width.
      """
      crop_ymin, crop_xmin, _ = tf.unstack(begin, axis=0)
      crop_height, crop_width, _ = tf.unstack(size, axis=0)
      ymin, xmin, _ = tf.unstack(tf.maximum(begin, 0), axis=0)
      offset_y = tf.maximum(0, ymin - crop_ymin)
      offset_x = tf.maximum(0, xmin - crop_xmin)
      return offset_y, offset_x, crop_height, crop_width
  
file_path: scenic/scenic/projects/owl_vit/preprocessing/transforms.py
imports: from typing import Any, Optional, Sequence, Tuple, Union
  import tensorflow
label_desc: Use image node_id 5 for calling a global function with example usage: get_padding_params_from_crop_slice(begin, size) and returns: offset_y,  offset_x,  crop_height,  crop_width