def get_padding_value(padding, kernel):
  """Returns padding value for kernel."""

  if padding == "valid":
    return 0
  elif padding == "same":
    return kernel // 2
  elif padding == "full":
    return kernel - 1

  raise ValueError("accepted paddings are 'valid', 'same' or 'full', found " +
                   padding)