code: def _onnx_paste_mask_in_image(mask, box, im_h, im_w):
      one = torch.ones(1, dtype=torch.int64)
      zero = torch.zeros(1, dtype=torch.int64)
  
      w = box[2] - box[0] + one
      h = box[3] - box[1] + one
      w = torch.max(torch.cat((w, one)))
      h = torch.max(torch.cat((h, one)))
  
      # Set shape to [batchxCxHxW]
      mask = mask.expand((1, 1, mask.size(0), mask.size(1)))
  
      # Resize mask
      mask = F.interpolate(
          mask,
          size=(int(h), int(w)),
          mode="bilinear",
          align_corners=False,
      )
      mask = mask[0][0]
  
      x_0 = torch.max(torch.cat((box[0].unsqueeze(0), zero)))
      x_1 = torch.min(
          torch.cat((box[2].unsqueeze(0) + one, im_w.unsqueeze(0)))
      )
      y_0 = torch.max(torch.cat((box[1].unsqueeze(0), zero)))
      y_1 = torch.min(
          torch.cat((box[3].unsqueeze(0) + one, im_h.unsqueeze(0)))
      )
  
      unpaded_im_mask = mask[
          (y_0 - box[1]) : (y_1 - box[1]),
          (x_0 - box[0]) : (x_1 - box[0]),
      ]
  
      # TODO : replace below with a dynamic padding when support is added in ONNX
  
      # pad y
      zeros_y0 = torch.zeros(y_0, unpaded_im_mask.size(1))
      zeros_y1 = torch.zeros(im_h - y_1, unpaded_im_mask.size(1))
      concat_0 = torch.cat(
          (zeros_y0, unpaded_im_mask.to(dtype=torch.float32), zeros_y1),
          0,
      )[0:im_h, :]
      # pad x
      zeros_x0 = torch.zeros(concat_0.size(0), x_0)
      zeros_x1 = torch.zeros(concat_0.size(0), im_w - x_1)
      im_mask = torch.cat((zeros_x0, concat_0, zeros_x1), 1)[:, :im_w]
      return im_mask
  
imports: from typing import Dict, List, Optional, Tuple
  import torch
  import torch.nn.functional
  import torchvision
  from torch import nn, Tensor
  from torchvision.ops import boxes, roi_align
  from .None import _utils
label_desc: Use image node_id 16 for calling a global function with example usage: _onnx_paste_mask_in_image(mask, box, im_h, im_w) and returns: im_mask