class_docstr: Wrapper class for PyTorch Categorical distribution.
  
  Creates a categorical distribution parameterized by either :attr:`probs` or
  :attr:`logits` (but not both).
  
  Samples are integers from :math:`\{0, \ldots, K-1\}` where `K` is
  ``probs.size(-1)``.
  
  If `probs` is 1-dimensional with length-`K`, each element is the relative
  probability of sampling the class at that index.
  
  If `probs` is N-dimensional, the first N-1 dimensions are treated as a batch of
  relative probability vectors.
  
  .. testcode::
      :skipif: True
  
      m = TorchCategorical(torch.tensor([ 0.25, 0.25, 0.25, 0.25 ]))
      m.sample(sample_shape=(2,))  # equal probability of 0, 1, 2, 3
  
  .. testoutput::
  
      tensor([3, 4])
  
  Args:
      logits: Event log probabilities (unnormalized)
      probs: The probablities of each event.
      temperature: In case of using logits, this parameter can be used to determine
          the sharpness of the distribution. i.e.
          ``probs = softmax(logits / temperature)``. The temperature must be strictly
          positive. A low value (e.g. 1e-10) will result in argmax sampling while a
          larger value will result in uniform sampling.
class_docstr_tok: ["Wrapper","class","for","PyTorch","Categorical","distribution",".","Creates","a","categorical","distribution","parameterized","by","either",":","attr",":","`","probs","`","or",":","attr",":","`","logits","`","(","but","not","both",")",".","Samples","are","integers","from",":","math",":","`","\\","{","0",",","\\ldots",",","K-1\\","}","`","where","`","K","`","is","``","probs.size","(","-1",")","``",".","If","`","probs","`","is","1-dimensional","with","length-","`","K","`",",","each","element","is","the","relative","probability","of","sampling","the","class","at","that","index",".","If","`","probs","`","is","N-dimensional",",","the","first","N-1","dimensions","are","treated","as","a","batch","of","relative","probability","vectors",".","..","testcode",":",":",":","skipif",":","True","m","=","TorchCategorical","(","torch.tensor","(","[","0.25",",","0.25",",","0.25",",","0.25","]",")",")","m.sample","(","sample_shape=","(","2",",",")",")","#","equal","probability","of","0",",","1",",","2",",","3","..","testoutput",":",":","tensor","(","[","3",",","4","]",")","Args",":","logits",":","Event","log","probabilities","(","unnormalized",")","probs",":","The","probablities","of","each","event",".","temperature",":","In","case","of","using","logits",",","this","parameter","can","be","used","to","determine","the","sharpness","of","the","distribution",".","i.e",".","``","probs","=","softmax","(","logits","\/","temperature",")","``",".","The","temperature","must","be","strictly","positive",".","A","low","value","(","e.g",".","1e-10",")","will","result","in","argmax","sampling","while","a","larger","value","will","result","in","uniform","sampling","."]
code: def from_logits(
      cls, logits: TensorType, **kwargs
  ) -> "TorchCategorical":
      return TorchCategorical(logits=logits, **kwargs)
  
imports: import gymnasium
  import numpy
  from typing import Optional, List, Mapping, Iterable, Dict
  import tree
  import abc
  from ray.rllib.models.distributions import Distribution
  from ray.rllib.utils.annotations import override, DeveloperAPI
  from ray.rllib.utils.framework import try_import_torch
  from ray.rllib.utils.typing import TensorType, Union, Tuple
label_desc: Use image node_id 5 for calling the TorchCategorical obj's underlying member method code with example usage: obj.from_logits(cls, logits) and returns: TorchCategorical