class_docstr: Applies padding to input (if needed) so that input can get fully covered
  by filter you specified. It support two modes "same" and "corner". The
  "same" mode is same with "SAME" padding mode in TensorFlow, pad zero around
  input. The "corner"  mode would pad zero to bottom right.
  
  Args:
      kernel_size (int | tuple): Size of the kernel:
      stride (int | tuple): Stride of the filter. Default: 1:
      dilation (int | tuple): Spacing between kernel elements.
          Default: 1
      padding (str): Support "same" and "corner", "corner" mode
          would pad zero to bottom right, and "same" mode would
          pad zero around input. Default: "corner".
  Example:
      >>> kernel_size = 16
      >>> stride = 16
      >>> dilation = 1
      >>> input = torch.rand(1, 1, 15, 17)
      >>> adap_pad = AdaptivePadding(
      >>>     kernel_size=kernel_size,
      >>>     stride=stride,
      >>>     dilation=dilation,
      >>>     padding="corner")
      >>> out = adap_pad(input)
      >>> assert (out.shape[2], out.shape[3]) == (16, 32)
      >>> input = torch.rand(1, 1, 16, 17)
      >>> out = adap_pad(input)
      >>> assert (out.shape[2], out.shape[3]) == (16, 32)
class_docstr_tok: ["Applies","padding","to","input","(","if","needed",")","so","that","input","can","get","fully","covered","by","filter","you","specified",".","It","support","two","modes","``","same","''","and","``","corner","''",".","The","''","same","''","mode","is","same","with","``","SAME","''","padding","mode","in","TensorFlow",",","pad","zero","around","input",".","The","``","corner","''","mode","would","pad","zero","to","bottom","right",".","Args",":","kernel_size","(","int","|","tuple",")",":","Size","of","the","kernel",":","stride","(","int","|","tuple",")",":","Stride","of","the","filter",".","Default",":","1",":","dilation","(","int","|","tuple",")",":","Spacing","between","kernel","elements",".","Default",":","1","padding","(","str",")",":","Support","``","same","''","and","``","corner","''",",","``","corner","''","mode","would","pad","zero","to","bottom","right",",","and","``","same","''","mode","would","pad","zero","around","input",".","Default",":","``","corner","''",".","Example",":",">",">",">","kernel_size","=","16",">",">",">","stride","=","16",">",">",">","dilation","=","1",">",">",">","input","=","torch.rand","(","1",",","1",",","15",",","17",")",">",">",">","adap_pad","=","AdaptivePadding","(",">",">",">","kernel_size=kernel_size",",",">",">",">","stride=stride",",",">",">",">","dilation=dilation",",",">",">",">","padding=","''","corner","''",")",">",">",">","out","=","adap_pad","(","input",")",">",">",">","assert","(","out.shape","[","2","]",",","out.shape","[","3","]",")","==","(","16",",","32",")",">",">",">","input","=","torch.rand","(","1",",","1",",","16",",","17",")",">",">",">","out","=","adap_pad","(","input",")",">",">",">","assert","(","out.shape","[","2","]",",","out.shape","[","3","]",")","==","(","16",",","32",")"]
code: def get_pad_shape(self, input_shape):
      input_h, input_w = input_shape
      kernel_h, kernel_w = self.kernel_size
      stride_h, stride_w = self.stride
      output_h = math.ceil(input_h / stride_h)
      output_w = math.ceil(input_w / stride_w)
      pad_h = max(
          (output_h - 1) * stride_h
          + (kernel_h - 1) * self.dilation[0]
          + 1
          - input_h,
          0,
      )
      pad_w = max(
          (output_w - 1) * stride_w
          + (kernel_w - 1) * self.dilation[1]
          + 1
          - input_w,
          0,
      )
      return pad_h, pad_w
  
imports: import math
  import warnings
  from typing import Sequence
  import torch
  import torch.nn
  import torch.nn.functional
  import torch.utils.checkpoint
  from mmcv.cnn import Linear, build_activation_layer, build_norm_layer, xavier_init
  from mmcv.cnn.bricks.drop import build_dropout
  from mmcv.cnn.bricks.registry import FEEDFORWARD_NETWORK, TRANSFORMER_LAYER, TRANSFORMER_LAYER_SEQUENCE
  from mmcv.cnn.bricks.transformer import BaseTransformerLayer, TransformerLayerSequence, build_transformer_layer_sequence
  from mmcv.runner.base_module import BaseModule, Sequential
  from mmcv.utils import deprecated_api_warning, to_2tuple
  from torch.nn.init import normal_
  from ..builder import TRANSFORMER
label_desc: Use image node_id 2 for calling the AdaptivePadding obj's underlying member method code with example usage: obj.get_pad_shape(input_shape) and returns: pad_h,  pad_w