class_docstr: The op `SwapAlign2Nat` described in https://arxiv.org/abs/1903.12174.
  Given an input tensor that predicts masks of shape (N, C=VxU, H, W),
  apply the op, it will return masks of shape (N, V'xU', H', W') where
  the unit lengths of (V, U) and (H, W) are swapped, and the mask representation
  is transformed from aligned to natural.
  Args:
      lambda_val (int): the relative unit length ratio between (V, U) and (H, W),
                          as we always have larger unit lengths for (V, U) than (H, W),
                          lambda_val is always >= 1.
      pad_val (float):    padding value for the values falling outside of the input
                          tensor, default set to -6 as sigmoid(-6) is ~0, indicating
                          that is no masks outside of the tensor.
class_docstr_tok: ["The","op","`","SwapAlign2Nat","`","described","in","https",":","\/\/arxiv.org\/abs\/1903.12174",".","Given","an","input","tensor","that","predicts","masks","of","shape","(","N",",","C=VxU",",","H",",","W",")",",","apply","the","op",",","it","will","return","masks","of","shape","(","N",",","V'xU","'",",","H","'",",","W","'",")","where","the","unit","lengths","of","(","V",",","U",")","and","(","H",",","W",")","are","swapped",",","and","the","mask","representation","is","transformed","from","aligned","to","natural",".","Args",":","lambda_val","(","int",")",":","the","relative","unit","length","ratio","between","(","V",",","U",")","and","(","H",",","W",")",",","as","we","always","have","larger","unit","lengths","for","(","V",",","U",")","than","(","H",",","W",")",",","lambda_val","is","always",">","=","1.","pad_val","(","float",")",":","padding","value","for","the","values","falling","outside","of","the","input","tensor",",","default","set","to","-6","as","sigmoid","(","-6",")","is","~0",",","indicating","that","is","no","masks","outside","of","the","tensor","."]
code: def forward(self, X):
      return swap_align2nat(X, self.lambda_val, self.pad_val)
  
file_path: detectron2/projects/TensorMask/tensormask/layers/swap_align2nat.py
imports: from torch import nn
  from torch.autograd import Function
  from torch.autograd.function import once_differentiable
  from tensormask import _C
label_desc: Use image node_id 2 for calling the SwapAlign2Nat obj's underlying member method code with example usage: obj.forward(X) and returns: swap_align2nat