code: def _get_pad(in_size, ksize, stride, tf_padding):
      if tf_padding == "SAME":
          tf_out_size = int(np.ceil(float(in_size) / stride))
      elif tf_padding == "VALID":
          tf_out_size = int(
              np.ceil(float(in_size - ksize + 1) / stride)
          )
      pad = int(stride * tf_out_size - in_size + ksize - stride)
      assert (
          conv.get_conv_outsize(in_size + pad, ksize, stride, 0)
          == tf_out_size
      )
      return pad
  
file_path: chainercv/chainercv/links/model/mobilenet/tf_convolution_2d.py
imports: import numpy
  import chainer
  from chainer.functions import pad
  from chainer.links import Convolution2D
  from chainer.utils import conv
label_desc: Use image node_id 2 for calling a global function with example usage: _get_pad(in_size, ksize, stride, tf_padding) and returns: pad