code: def _get_param_spatial_crop(
      scale: Tuple[float, float],
      ratio: Tuple[float, float],
      height: int,
      width: int,
      log_uniform_ratio: bool = True,
      num_tries: int = 10,
  ) -> Tuple[int, int, int, int]:
      """
      Given scale, ratio, height and width, return sampled coordinates of the videos.
  
      Args:
          scale (Tuple[float, float]): Scale range of Inception-style area based
              random resizing.
          ratio (Tuple[float, float]): Aspect ratio range of Inception-style
              area based random resizing.
          height (int): Height of the original image.
          width (int): Width of the original image.
          log_uniform_ratio (bool): Whether to use a log-uniform distribution to
              sample the aspect ratio. Default is True.
          num_tries (int): The number of times to attempt a randomly resized crop.
              Falls back to a central crop after all attempts are exhausted.
              Default is 10.
  
      Returns:
          Tuple containing i, j, h, w. (i, j) are the coordinates of the top left
          corner of the crop. (h, w) are the height and width of the crop.
      """
      assert num_tries >= 1, "num_tries must be at least 1"
  
      if scale[0] > scale[1]:
          scale = (scale[1], scale[0])
      if ratio[0] > ratio[1]:
          ratio = (ratio[1], ratio[0])
  
      for _ in range(num_tries):
          area = height * width
          target_area = area * (
              scale[0] + torch.rand(1).item() * (scale[1] - scale[0])
          )
          if log_uniform_ratio:
              log_ratio = (math.log(ratio[0]), math.log(ratio[1]))
              aspect_ratio = math.exp(
                  log_ratio[0]
                  + torch.rand(1).item() * (log_ratio[1] - log_ratio[0])
              )
          else:
              aspect_ratio = ratio[0] + torch.rand(1).item() * (
                  ratio[1] - ratio[0]
              )
  
          w = int(round(math.sqrt(target_area * aspect_ratio)))
          h = int(round(math.sqrt(target_area / aspect_ratio)))
  
          if 0 < w <= width and 0 < h <= height:
              i = torch.randint(0, height - h + 1, (1,)).item()
              j = torch.randint(0, width - w + 1, (1,)).item()
              return i, j, h, w
  
      # Fallback to central crop.
      in_ratio = float(width) / float(height)
      if in_ratio < min(ratio):
          w = width
          h = int(round(w / min(ratio)))
      elif in_ratio > max(ratio):
          h = height
          w = int(round(h * max(ratio)))
      else:  # whole image
          w = width
          h = height
      i = (height - h) // 2
      j = (width - w) // 2
      return i, j, h, w
  
imports: import copy
  import math
  from typing import Tuple
  import numpy
  import torch
label_desc: Use image node_id 15 for calling a global function with example usage: _get_param_spatial_crop(scale, ratio, height, width, log_uniform_ratio, num_tries) and returns: i,  j,  h,  w, i,  j,  h,  w