code: def smart_resize(
      tens: Tensor,
      target_size: Tuple[int, int],
      interpolation="bilinear",
  ) -> Tensor:
      r"""
      Resizes an image to a target_size without aspect ratio distortion.
  
      Your output images will be of size `target_size`, and will not be distorted. Instead, the parts of the image that do not fit within the target size get cropped out.
  
      The resizing process is:
      1. Resize the image as minimally as possible.
      2. Take the largest centered crop of the image with dimensions = `target_size`.
  
      Alternatively, you may use:
      ```python
      size = (200,200)
      tens = caer.resize(tens, target_size=size, preserve_aspect_ratio=True)
      ```
  
      Args:
          tens (Tensor): Input Image. Must be in the format `(height, width, channels)`.
          target_size (tuple): Target size. Must be a tuple of `(width, height)` integer.
          interpolation (str): Interpolation to use for resizing. Defaults to `'bilinear'`.
              Supports `'bilinear'`, `'bicubic'`, `'area'`, `'nearest'`.
  
      Returns:
          Tensor of shape `(height, width, channels)`
  
      Examples::
  
          >> tens = caer.data.sunrise()
          >> tens.shape
          (427, 640, 3)
          >> resized = caer.smart_resize(tens, target_size=(200,200))
          >> resized.shape
          (200, 200, 3)
      """
      # if not isinstance(tens, Tensor):
      #     raise ValueError("To use `caer.smart_resize()`, `tens` needs to be a caer.Tensor")
  
      im = _resize_with_ratio(
          tens,
          target_size=target_size,
          preserve_aspect_ratio=True,
          interpolation=interpolation,
      )
  
      # For this function, the <cspace> attribute is not required.
      # So, we disable the mandatory check that the <cspace> attribute needs to be passed for
      # foreign Tensors/ndarrays
      return to_tensor(im, override_checks=True)
  
file_path: caer/caer/io/resize.py
imports: import math
  import cv2
  from ..coreten import Tensor, to_tensor
  from .._internal import _check_target_size
  from ..globals import INTER_AREA, INTER_CUBIC, INTER_NEAREST, INTER_LINEAR
  from typing import Tuple, Optional, Union
label_desc: Use image node_id 2 for calling a global function with example usage: smart_resize(tens, target_size, interpolation) and returns: to_tensor