code: def _kl_div_2d(p: Tensor, q: Tensor) -> Tensor:
      # D_KL(P || Q)
      batch, chans, height, width = p.shape
      unsummed_kl = F.kl_div(
          q.reshape(batch * chans, height * width).log(),
          p.reshape(batch * chans, height * width),
          reduction="none",
      )
      kl_values = unsummed_kl.sum(-1).view(batch, chans)
      return kl_values
  
file_path: kornia/kornia/losses/divergence.py
imports: from __future__ import annotations
  import torch
  import torch.nn.functional
  from kornia.core import Tensor
label_desc: Use image node_id 1 for calling a global function with example usage: _kl_div_2d(p, q) and returns: kl_values