class_docstr: Base class for stochastic policies.
  
  Args:
      temperature (parameter | dict[parameter], float >= 0.0): Sampling temperature, global or
          per action (<span style="color:#00C000"><b>default</b></span>: 1.0).
      device (string): Device name
          (<span style="color:#00C000"><b>default</b></span>: inherit value of parent module).
      l2_regularization (float >= 0.0): Scalar controlling L2 regularization
          (<span style="color:#00C000"><b>default</b></span>: inherit value of parent module).
      name (string): <span style="color:#0000C0"><b>internal use</b></span>.
      states_spec (specification): <span style="color:#0000C0"><b>internal use</b></span>.
      auxiliaries_spec (specification): <span style="color:#0000C0"><b>internal use</b></span>.
      actions_spec (specification): <span style="color:#0000C0"><b>internal use</b></span>.
      kldiv_reference_spec (specification):
          <span style="color:#0000C0"><b>internal use</b></span>.
class_docstr_tok: ["Base","class","for","stochastic","policies",".","Args",":","temperature","(","parameter","|","dict","[","parameter","]",",","float",">","=","0.0",")",":","Sampling","temperature",",","global","or","per","action","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","1.0",")",".","device","(","string",")",":","Device","name","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","inherit","value","of","parent","module",")",".","l2_regularization","(","float",">","=","0.0",")",":","Scalar","controlling","L2","regularization","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","inherit","value","of","parent","module",")",".","name","(","string",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">",".","states_spec","(","specification",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">",".","auxiliaries_spec","(","specification",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">",".","actions_spec","(","specification",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">",".","kldiv_reference_spec","(","specification",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">","."]
code: def __init__(
      self,
      *,
      temperature=1.0,
      device=None,
      l2_regularization=None,
      name=None,
      states_spec=None,
      auxiliaries_spec=None,
      internals_spec=None,
      actions_spec=None,
      kldiv_reference_spec=None,
  ):
      super().__init__(
          device=device,
          l2_regularization=l2_regularization,
          name=name,
          states_spec=states_spec,
          auxiliaries_spec=auxiliaries_spec,
          actions_spec=actions_spec,
      )
  
      self.kldiv_reference_spec = kldiv_reference_spec
  
      # Sampling temperature
      if temperature is None:
          temperature = 1.0
      if isinstance(temperature, dict) and all(
          name in self.actions_spec for name in temperature
      ):
          # Different temperature per action
  
          def function(name, spec):
              return self.submodule(
                  name=(name + "_temperature"),
                  module=temperature.get(name, 0.0),
                  modules=parameter_modules,
                  is_trainable=False,
                  dtype="float",
                  min_value=0.0,
              )
  
          self.temperature = self.actions_spec.fmap(
              function=function, cls=ModuleDict, with_names=True
          )
  
      else:
          # Same temperature for all actions
          self.temperature = self.submodule(
              name="temperature",
              module=temperature,
              modules=parameter_modules,
              is_trainable=False,
              dtype="float",
              min_value=0.0,
          )
  
file_path: tensorforce/tensorforce/core/policies/stochastic_policy.py
imports: import tensorflow
  from tensorforce.core import ModuleDict, parameter_modules, SignatureDict, TensorDict, TensorSpec, TensorsSpec, tf_function, tf_util
  from tensorforce.core.policies import Policy
label_desc: Use image node_id 1 to create a new StochasticPolicy object from inherited base classes: Policy with example: obj = StochasticPolicy()