class_docstr: Dictionary probability distribution.
  
  The respective functions either return
      - the per key distribution properties or
      - aggregate the properties across the sub-distributions using a reduce_fun such as mean or sum.
  
  :param distribution_dict: dictionary holding sub-probability distributions.
class_docstr_tok: ["Dictionary","probability","distribution",".","The","respective","functions","either","return","-","the","per","key","distribution","properties","or","-","aggregate","the","properties","across","the","sub-distributions","using","a","reduce_fun","such","as","mean","or","sum",".",":","param","distribution_dict",":","dictionary","holding","sub-probability","distributions","."]
docstr: implementation of :class:`~maze.distributions.torch_dist.TorchProbabilityDistribution` interface
          
docstr_tok: ["implementation","of",":","class",":","`","~maze.distributions.torch_dist.TorchProbabilityDistribution","`","interface"]
code: def kl(
      self,
      other: "DictProbabilityDistribution",
      reduce_fun: callable = torch.mean,
  ) -> torch.Tensor:
      """implementation of :class:`~maze.distributions.torch_dist.TorchProbabilityDistribution` interface"""
      # collect and stack kls of individual distributions
      kl_list = []
      for k in self.distribution_dict.keys():
          kl_list.append(
              self.distribution_dict[k].kl(other.distribution_dict[k])
          )
      entropy_list = torch.stack(kl_list)
      assert entropy_list.shape[0] == len(self.distribution_dict)
  
      return reduce_fun(entropy_list, dim=0)
  
file_path: maze/maze/distributions/dict.py
imports: from typing import Dict
  import torch
  from maze.core.annotations import override
  from maze.distributions.distribution import ProbabilityDistribution
label_desc: Use image node_id 5 for calling the DictProbabilityDistribution obj's underlying member method code with example usage: obj.kl(other, reduce_fun) and returns: reduce_fun