may be this is what you are looking
  

      github.com
  

  
    pytorch/vision/blob/eac3dc7bab436725b0ba65e556d3a6ffd43c24e1/torchvision/ops/roi_align.py#L13



      
      
          import torch
          from torch import nn, Tensor
          from torch.jit.annotations import BroadcastingList2
          from torch.nn.modules.utils import _pair
          from torchvision.extension import _assert_has_ops
          
          
from ..utils import _log_api_usage_once
          from ._utils import convert_boxes_to_roi_format, check_roi_boxes_shape
          
          

          
def roi_align(
              input: Tensor,
              boxes: Union[Tensor, List[Tensor]],
              output_size: BroadcastingList2[int],
              spatial_scale: float = 1.0,
              sampling_ratio: int = -1,
              aligned: bool = False,
          ) -> Tensor:
              """
              Performs Region of Interest (RoI) Align operator with average pooling, as described in Mask R-CNN.