class_docstr: An exploration that simply samples from a distribution.
  
  The sampling can be made deterministic by passing explore=False into
  the call to `get_exploration_action`.
  Also allows for scheduled parameters for the distributions, such as
  lowering stddev, temperature, etc.. over time.
class_docstr_tok: ["An","exploration","that","simply","samples","from","a","distribution",".","The","sampling","can","be","made","deterministic","by","passing","explore=False","into","the","call","to","`","get_exploration_action","`",".","Also","allows","for","scheduled","parameters","for","the","distributions",",","such","as","lowering","stddev",",","temperature",",","etc","..","over","time","."]
code: def _get_torch_exploration_action(
      self,
      action_dist: ActionDistribution,
      timestep: Union[TensorType, int],
      explore: Union[TensorType, bool],
  ):
      # Set last timestep or (if not given) increase by one.
      self.last_timestep = (
          timestep if timestep is not None else self.last_timestep + 1
      )
  
      # Apply exploration.
      if explore:
          # Random exploration phase.
          if self.last_timestep < self.random_timesteps:
              (
                  action,
                  logp,
              ) = self.random_exploration.get_torch_exploration_action(
                  action_dist, explore=True
              )
          # Take a sample from our distribution.
          else:
              action = action_dist.sample()
              logp = action_dist.sampled_action_logp()
  
      # No exploration -> Return deterministic actions.
      else:
          action = action_dist.deterministic_sample()
          logp = torch.zeros_like(action_dist.sampled_action_logp())
  
      return action, logp
  
file_path: ray/python/ray/rllib/utils/exploration/stochastic_sampling.py
imports: import functools
  import gymnasium
  import numpy
  from typing import Optional, Union
  from ray.rllib.models.action_dist import ActionDistribution
  from ray.rllib.models.modelv2 import ModelV2
  from ray.rllib.utils.annotations import override, PublicAPI
  from ray.rllib.utils.exploration.exploration import Exploration
  from ray.rllib.utils.exploration.random import Random
  from ray.rllib.utils.framework import get_variable, try_import_tf, try_import_torch, TensorType
  from ray.rllib.utils.tf_utils import zero_logps_from_actions
label_desc: Use image node_id 4 for calling the StochasticSampling obj's underlying member method code with example usage: obj._get_torch_exploration_action(action_dist, timestep, explore) and returns: action,  logp