code: def _bilinear_interpolation_grid_sample(
      image: torch.Tensor, grid: torch.Tensor
  ) -> torch.Tensor:
      """
      Bi linearly interpolate the image using the uv positions in the flow-field
      grid (following the conventions for torch.nn.functional.grid_sample).
  
      This implementation is faster than _bilinear_interpolation_vectorized but
      requires more memory so can cause OOMs. If speed is an issue try this function
      instead.
  
      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.
      """
  
      N = grid.shape[0]
      # convert [0, 1] to the range [-1, 1] expected by grid_sample.
      grid = grid * 2.0 - 1.0
      image = image.permute(2, 0, 1)[None, ...].expand(
          N, -1, -1, -1
      )  # (N, 3, H, W)
      # Align_corners has to be set to True to match the output of the SoftRas
      # cuda kernel for bilinear sampling.
      out = F.grid_sample(
          image, grid, mode="bilinear", align_corners=True
      )
      return out.permute(0, 2, 3, 1)
  
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 4 for calling a global function with example usage: _bilinear_interpolation_grid_sample(image, grid) and returns: out