code: def _bilinear_interpolation_vectorized(
      image: torch.Tensor, grid: torch.Tensor
  ) -> torch.Tensor:
      """
      Bi linearly interpolate the image using the uv positions in the flow-field
      grid (following the naming conventions for torch.nn.functional.grid_sample).
  
      This implementation uses the same steps as in the SoftRasterizer CUDA kernel
      for loading textures. We are keeping it for reference to make it easy to
      compare if required.
  
      However it doesn't properly handle the out of bound values in the same way as
      the grid_sample function does with the padding_mode argument.
      This vectorized version requires less memory than
      _bilinear_interpolation_grid_sample but is slightly slower.
  
      Args:
          image: FloatTensor of shape (H, W, D) a single image/input tensor with D
              channels.
          grid: FloatTensor of shape (N, R, R, 2) giving the pixel locations of the
              points at which to sample a value in the image. The grid values must
              be in the range [0, 1]. u is the x direction and v is the y direction.
  
      Returns:
          out: FloatTensor of shape (N, H, W, D) giving the interpolated
              D dimensional value from image at each of the pixel locations in grid.
  
      """
      H, W, _ = image.shape
      # Convert [0, 1] to the range [0, W-1] and [0, H-1]
      grid = grid * torch.tensor([W - 1, H - 1]).type_as(grid)
      weight_1 = grid - grid.int()
      weight_0 = 1.0 - weight_1
  
      grid_x, grid_y = grid.unbind(-1)
      y0 = grid_y.to(torch.int64)
      y1 = (grid_y + 1).to(torch.int64)
      x0 = grid_x.to(torch.int64)
      x1 = x0 + 1
  
      weight_x0, weight_y0 = weight_0.unbind(-1)
      weight_x1, weight_y1 = weight_1.unbind(-1)
  
      # Bi-linear interpolation
      # griditions = [[y,     x], [(y+1),     x]
      #              [y, (x+1)], [(y+1), (x+1)]]
      # weights   = [[wx0*wy0, wx0*wy1],
      #              [wx1*wy0, wx1*wy1]]
      out = (
          image[y0, x0] * (weight_x0 * weight_y0)[..., None]
          + image[y1, x0] * (weight_x0 * weight_y1)[..., None]
          + image[y0, x1] * (weight_x1 * weight_y0)[..., None]
          + image[y1, x1] * (weight_x1 * weight_y1)[..., None]
      )
  
      return out
  
file_path: pytorch3d/pytorch3d/io/mtl_io.py
imports: import os
  import warnings
  from typing import Dict, List, Optional, Tuple
  import numpy
  import torch
  import torch.nn.functional
  from iopath.common.file_io import PathManager
  from pytorch3d.common.compat import meshgrid_ij
  from pytorch3d.common.datatypes import Device
  from pytorch3d.io.utils import _open_file, _read_image
label_desc: Use image node_id 3 for calling a global function with example usage: _bilinear_interpolation_vectorized(image, grid) and returns: out