code: def kl_div(
      input,
      label,
      reduction="mean",
      name=None,
  ):
      if input.shape != label.shape:
          raise ValueError(
              "the shape of input tensor should be equal to target tensor, but found"
              " inputs with different sizes"
          )
  
      out = label * (ivy.log(label) - input)
  
      size = ivy.shape(input)
      if len(size) < 1:
          size = [1]
  
      if reduction == "mean":
          out = ivy.mean(out)
      elif reduction == "batchmean":
          out = ivy.sum(out) / size[0]
      elif reduction == "sum":
          out = ivy.sum(out)
      else:
          pass
      return out.astype(label.dtype)
  
imports: import ivy
  from ivy.func_wrapper import with_supported_dtypes
  import ivy.functional.frontends.paddle
  from ivy.utils.exceptions import handle_exceptions
  from ivy.functional.frontends.paddle.func_wrapper import inputs_to_ivy_arrays, to_ivy_arrays_and_back
label_desc: Use image node_id 8 for calling a global function with example usage: kl_div(input, label, reduction, name) and returns: out