code: def distribution_cat(
      distributions: List[Distribution], dim=0
  ) -> Distribution:
      args = list(distributions[0].arg_constraints.keys())
      if "probs" in args and "logits" in args:
          try:
              _ = getattr(distributions[0], "probs")
              args.remove("logits")
          except AttributeError:
              args.remove("probs")
      concat_args = {
          arg: pt.cat([getattr(d, arg) for d in distributions], dim=dim)
          for arg in args
      }
      return type(distributions[0])(**concat_args)
  
file_path: gluonts/src/gluonts/nursery/daf/tslib/nn/distributions.py
imports: from typing import List, Tuple
  import torch
  from torch import Tensor
  from torch import nn
  from torch.distributions import Distribution
  from .activations import PositiveSoftplus
label_desc: Use image node_id 1 for calling a global function with example usage: distribution_cat(distributions, dim) and returns: type