class_docstr: YOLACT mask head used in https://arxiv.org/abs/1904.02689.
  
  This head outputs the mask prototypes for YOLACT.
  
  Args:
      in_channels (int): Number of channels in the input feature map.
      proto_channels (tuple[int]): Output channels of protonet convs.
      proto_kernel_sizes (tuple[int]): Kernel sizes of protonet convs.
      include_last_relu (Bool): If keep the last relu of protonet.
      num_protos (int): Number of prototypes.
      num_classes (int): Number of categories excluding the background
          category.
      loss_mask_weight (float): Reweight the mask loss by this factor.
      max_masks_to_train (int): Maximum number of masks to train for
          each image.
docstr: Sanitizes the input coordinates so that x1 < x2, x1 != x2, x1 >= 0,
  and x2 <= image_size. Also converts from relative to absolute
  coordinates and casts the results to long tensors.
  
  Warning: this does things in-place behind the scenes so
  copy if necessary.
  
  Args:
      _x1 (Tensor): shape (N, ).
      _x2 (Tensor): shape (N, ).
      img_size (int): Size of the input image.
      padding (int): x1 >= padding, x2 <= image_size-padding.
      cast (bool): If cast is false, the result won't be cast to longs.
  
  Returns:
      tuple:
          x1 (Tensor): Sanitized _x1.
          x2 (Tensor): Sanitized _x2.
docstr_tok: ["Sanitizes","the","input","coordinates","so","that","x1","<","x2",",","x1","!","=","x2",",","x1",">","=","0",",","and","x2","<","=","image_size",".","Also","converts","from","relative","to","absolute","coordinates","and","casts","the","results","to","long","tensors",".","Warning",":","this","does","things","in-place","behind","the","scenes","so","copy","if","necessary",".","Args",":","_x1","(","Tensor",")",":","shape","(","N",",",")",".","_x2","(","Tensor",")",":","shape","(","N",",",")",".","img_size","(","int",")",":","Size","of","the","input","image",".","padding","(","int",")",":","x1",">","=","padding",",","x2","<","=","image_size-padding",".","cast","(","bool",")",":","If","cast","is","false",",","the","result","wo","n't","be","cast","to","longs",".","Returns",":","tuple",":","x1","(","Tensor",")",":","Sanitized","_x1",".","x2","(","Tensor",")",":","Sanitized","_x2","."]
code: def sanitize_coordinates(
      self, x1, x2, img_size, padding=0, cast=True
  ):
      """Sanitizes the input coordinates so that x1 < x2, x1 != x2, x1 >= 0,
      and x2 <= image_size. Also converts from relative to absolute
      coordinates and casts the results to long tensors.
  
      Warning: this does things in-place behind the scenes so
      copy if necessary.
  
      Args:
          _x1 (Tensor): shape (N, ).
          _x2 (Tensor): shape (N, ).
          img_size (int): Size of the input image.
          padding (int): x1 >= padding, x2 <= image_size-padding.
          cast (bool): If cast is false, the result won't be cast to longs.
  
      Returns:
          tuple:
              x1 (Tensor): Sanitized _x1.
              x2 (Tensor): Sanitized _x2.
      """
      x1 = x1 * img_size
      x2 = x2 * img_size
      if cast:
          x1 = x1.long()
          x2 = x2.long()
      x1 = torch.min(x1, x2)
      x2 = torch.max(x1, x2)
      x1 = torch.clamp(x1 - padding, min=0)
      x2 = torch.clamp(x2 + padding, max=img_size)
      return x1, x2
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule, xavier_init
  from mmcv.runner import force_fp32
  from mmdet.core import build_sampler, fast_nms, images_to_levels, multi_apply
  from ..builder import HEADS, build_loss
  from .anchor_head import AnchorHead
label_desc: Use image node_id 9 for calling the YOLACTProtonet obj's underlying member method code with example usage: obj.sanitize_coordinates(x1, x2, img_size, padding, cast) and returns: x1,  x2