code: def calculate_padding(input, scaling_factor):
      def scale(i, f):
          return (f - i % f) % f
  
      shape = input.shape
      dyn_shape = K.shape(input)
      px = scale(shape[1] or K.gather(dyn_shape, 1), scaling_factor[0])
      py = scale(shape[2] or K.gather(dyn_shape, 2), scaling_factor[1])
      return px, py
  
file_path: calamari/calamari_ocr/ocr/model/graph.py
imports: from functools import partial
  import tensorflow
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import ctc_ops
  from tfaip.model.graphbase import GraphBase
  from calamari_ocr.ocr.model.layers.concat import ConcatLayerParams
  from calamari_ocr.ocr.model.layers.toinputdims import ToInputDimsLayerParams
  from calamari_ocr.ocr.model.layers.transposedconv2d import TransposedConv2DLayerParams
  from calamari_ocr.ocr.model.params import ModelParams
label_desc: Use image node_id 1 for calling a global function with example usage: calculate_padding(input, scaling_factor) and returns: px,  py, unknown