def get_padding(size, kernel_size, strides):
  """ Calculate the padding array for same padding in the Tensorflow fashion.\\
  See https://www.tensorflow.org/api_guides/python/nn#Convolution for more.
  """
  if size[0] % strides[0] == 0:
    pad_h = max(kernel_size[0] - strides[0], 0)
  else:
    pad_h = max(kernel_size[0] - (size[0] % strides[0]), 0)
  if size[1] % strides[1] == 0:
    pad_w = max(kernel_size[1] - strides[1], 0)
  else:
    pad_w = max(kernel_size[1] - (size[1] % strides[1]), 0)
  return [pad_h//2, pad_w//2, pad_h-pad_h//2, pad_w-pad_w//2]