code: def padtype_to_pads(in_shape, window_shape, window_strides, padding):
    
    padding = padding.upper()
    if padding == 'SAME':
      out_shape = onp.ceil(
          onp.true_divide(in_shape, window_strides)).astype(int)
      pad_sizes = [max((out_size - 1) * stride + window_shape - in_size, 0)
                   for out_size, stride, window_shape, in_size
                   in zip(out_shape, window_strides, window_shape, in_shape)]
      return [(pad_size // 2, pad_size - pad_size // 2)
              for pad_size in pad_sizes]
    elif padding == 'VALID':
      return [(0, 0)] * len(in_shape)
    else:
      msg = 'Unknown padding type: {}.'
      raise TypeError(msg.format(padding))
docs: Convert padding string to list of pairs of pad values.