class_docstr: The base class for distribution over a random variable.
  
  Examples:
  
  .. testcode::
  
      import torch
      from ray.rllib.core.models.configs import MLPHeadConfig
      from ray.rllib.models.torch.torch_distributions import TorchCategorical
  
      model = MLPHeadConfig(input_dims=[1]).build(framework="torch")
  
      # Create an action distribution from model logits
      action_logits = model(torch.Tensor([[1]]))
      action_dist = TorchCategorical.from_logits(action_logits)
      action = action_dist.sample()
  
      # Create another distribution from a dummy Tensor
      action_dist2 = TorchCategorical.from_logits(torch.Tensor([0]))
  
      # Compute some common metrics
      logp = action_dist.logp(action)
      kl = action_dist.kl(action_dist2)
      entropy = action_dist.entropy()
class_docstr_tok: ["The","base","class","for","distribution","over","a","random","variable",".","Examples",":","..","testcode",":",":","import","torch","from","ray.rllib.core.models.configs","import","MLPHeadConfig","from","ray.rllib.models.torch.torch_distributions","import","TorchCategorical","model","=","MLPHeadConfig","(","input_dims=","[","1","]",")",".build","(","framework=","''","torch","''",")","#","Create","an","action","distribution","from","model","logits","action_logits","=","model","(","torch.Tensor","(","[","[","1","]","]",")",")","action_dist","=","TorchCategorical.from_logits","(","action_logits",")","action","=","action_dist.sample","(",")","#","Create","another","distribution","from","a","dummy","Tensor","action_dist2","=","TorchCategorical.from_logits","(","torch.Tensor","(","[","0","]",")",")","#","Compute","some","common","metrics","logp","=","action_dist.logp","(","action",")","kl","=","action_dist.kl","(","action_dist2",")","entropy","=","action_dist.entropy","(",")"]
docstr: Returns a deterministic equivalent for this distribution.
  
  Specifically, the deterministic equivalent for a Categorical distribution is a
  Deterministic distribution that selects the action with maximum logit value.
  Generally, the choice of the deterministic replacement is informed by
  established conventions.
docstr_tok: ["Returns","a","deterministic","equivalent","for","this","distribution",".","Specifically",",","the","deterministic","equivalent","for","a","Categorical","distribution","is","a","Deterministic","distribution","that","selects","the","action","with","maximum","logit","value",".","Generally",",","the","choice","of","the","deterministic","replacement","is","informed","by","established","conventions","."]
code: def to_deterministic(self) -> "Distribution":
      """Returns a deterministic equivalent for this distribution.
  
      Specifically, the deterministic equivalent for a Categorical distribution is a
      Deterministic distribution that selects the action with maximum logit value.
      Generally, the choice of the deterministic replacement is informed by
      established conventions.
      """
      raise NotImplementedError
  
file_path: ray/python/ray/rllib/models/distributions.py
imports: from typing import Tuple
  import gymnasium
  import abc
  from ray.rllib.utils.annotations import ExperimentalAPI
  from ray.rllib.utils.typing import TensorType, Union
  from ray.rllib.utils.annotations import override
label_desc: Use image node_id 9 for calling the Distribution obj's underlying member method code with example usage: obj.to_deterministic() without return types