class_docstr: Policy which parametrizes independent distributions per action, conditioned on the output of a
  central neural network processing the input state, supporting both a stochastic and value-based
  policy interface (specification key: `parametrized_distributions`).
  
  Args:
      network ('auto' | specification): Policy network configuration, see
          [networks](../modules/networks.html)
          (<span style="color:#00C000"><b>default</b></span>: 'auto', automatically configured
          network).
      single_output (bool): Whether the network returns a single embedding tensor or, in the case
          of multiple action components, specifies additional outputs for some/all action
          distributions, via registered tensors with name "[ACTION]-embedding"
          (<span style="color:#00C000"><b>default</b></span>: single output).
      distributions (dict[specification]): Distributions configuration, see
          [distributions](../modules/distributions.html), specified per
          action-type or -name
          (<span style="color:#00C000"><b>default</b></span>: per action-type, Bernoulli
          distribution for binary boolean actions, categorical distribution for discrete integer
          actions, Gaussian distribution for unbounded continuous actions, Beta distribution for
          bounded continuous actions).
      temperature (parameter | dict[parameter], float >= 0.0): Sampling temperature, global or
          per action (<span style="color:#00C000"><b>default</b></span>: 1.0).
      use_beta_distribution (bool): Whether to use the Beta distribution for bounded continuous
          actions by default.
          (<span style="color:#00C000"><b>default</b></span>: false).
      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>.
      internals_spec (specification): <span style="color:#0000C0"><b>internal use</b></span>.
      actions_spec (specification): <span style="color:#0000C0"><b>internal use</b></span>.
class_docstr_tok: ["Policy","which","parametrizes","independent","distributions","per","action",",","conditioned","on","the","output","of","a","central","neural","network","processing","the","input","state",",","supporting","both","a","stochastic","and","value-based","policy","interface","(","specification","key",":","`","parametrized_distributions","`",")",".","Args",":","network","(","'auto","'","|","specification",")",":","Policy","network","configuration",",","see","[","networks","]","(","..","\/modules\/networks.html",")","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","'auto","'",",","automatically","configured","network",")",".","single_output","(","bool",")",":","Whether","the","network","returns","a","single","embedding","tensor","or",",","in","the","case","of","multiple","action","components",",","specifies","additional","outputs","for","some\/all","action","distributions",",","via","registered","tensors","with","name","``","[","ACTION","]","-embedding","''","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","single","output",")",".","distributions","(","dict","[","specification","]",")",":","Distributions","configuration",",","see","[","distributions","]","(","..","\/modules\/distributions.html",")",",","specified","per","action-type","or","-name","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","per","action-type",",","Bernoulli","distribution","for","binary","boolean","actions",",","categorical","distribution","for","discrete","integer","actions",",","Gaussian","distribution","for","unbounded","continuous","actions",",","Beta","distribution","for","bounded","continuous","actions",")",".","temperature","(","parameter","|","dict","[","parameter","]",",","float",">","=","0.0",")",":","Sampling","temperature",",","global","or","per","action","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","1.0",")",".","use_beta_distribution","(","bool",")",":","Whether","to","use","the","Beta","distribution","for","bounded","continuous","actions","by","default",".","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","false",")",".","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",">",".","internals_spec","(","specification",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">",".","actions_spec","(","specification",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">","."]
code: def act_entropy(
      self,
      *,
      states,
      horizons,
      internals,
      auxiliaries,
      deterministic,
      independent,
  ):
      assertions = list()
      if self.config.create_tf_assertions:
          if not independent:
              false = tf_util.constant(value=False, dtype="bool")
              assertions.append(
                  tf.debugging.assert_equal(x=deterministic, y=false)
              )
  
      embedding, internals = self.network.apply(
          x=states,
          horizons=horizons,
          internals=internals,
          deterministic=deterministic,
          independent=independent,
      )
      if not isinstance(embedding, TensorDict):
          embedding = TensorDict(embedding=embedding)
  
      def fn_mode():
          def function(name, distribution):
              if name is None:
                  x = embedding.get(
                      "action-embedding", embedding["embedding"]
                  )
              else:
                  x = embedding.get(
                      name + "-embedding", embedding["embedding"]
                  )
              conditions = auxiliaries.get(name, default=TensorDict())
              parameters = distribution.parametrize(
                  x=x, conditions=conditions
              )
              mode = distribution.mode(
                  parameters=parameters, independent=independent
              )
              entropy = distribution.entropy(parameters=parameters)
              return mode, entropy
  
          return self.distributions.fmap(
              function=function, cls=TensorDict, with_names=True
          )
  
      def fn_sample():
          if isinstance(self.temperature, dict):
  
              def function(name, distribution, temp):
                  if name is None:
                      x = embedding.get(
                          "action-embedding", embedding["embedding"]
                      )
                  else:
                      x = embedding.get(
                          name + "-embedding", embedding["embedding"]
                      )
                  conditions = auxiliaries.get(
                      name, default=TensorDict()
                  )
                  parameters = distribution.parametrize(
                      x=x, conditions=conditions
                  )
                  sample = distribution.sample(
                      parameters=parameters,
                      temperature=temp,
                      independent=independent,
                  )
                  entropy = distribution.entropy(parameters=parameters)
                  return sample, entropy
  
              temperature = self.temperature.fmap(
                  function=(lambda x: x.value()), cls=TensorDict
              )
              return self.distributions.fmap(
                  function=function,
                  cls=TensorDict,
                  with_names=True,
                  zip_values=(temperature,),
              )
  
          else:
              temperature = self.temperature.value()
  
              def function(name, distribution):
                  if name is None:
                      x = embedding.get(
                          "action-embedding", embedding["embedding"]
                      )
                  else:
                      x = embedding.get(
                          name + "-embedding", embedding["embedding"]
                      )
                  conditions = auxiliaries.get(
                      name, default=TensorDict()
                  )
                  parameters = distribution.parametrize(
                      x=x, conditions=conditions
                  )
                  sample = distribution.sample(
                      parameters=parameters,
                      temperature=temperature,
                      independent=independent,
                  )
                  entropy = distribution.entropy(parameters=parameters)
                  return sample, entropy
  
              return self.distributions.fmap(
                  function=function, cls=TensorDict, with_names=True
              )
  
      with tf.control_dependencies(control_inputs=assertions):
          actions, entropies = tf.cond(
              pred=deterministic, true_fn=fn_mode, false_fn=fn_sample
          )
  
          def function(value, spec):
              return tf.reshape(tensor=value, shape=(-1, spec.size))
  
          # See also implementation of StochasticPolicy.entropy()
          entropies = entropies.fmap(
              function=function, zip_values=self.actions_spec
          )
          entropies = tf.concat(
              values=tuple(entropies.values()), axis=1
          )
          entropy = tf.math.reduce_mean(input_tensor=entropies, axis=1)
  
          return actions, internals, entropy
  
file_path: tensorforce/tensorforce/core/policies/parametrized_distributions.py
imports: import tensorflow
  from tensorforce.core import distribution_modules, ModuleDict, TensorDict, TensorsSpec, tf_function, tf_util
  from tensorforce.core.policies import ParametrizedPolicy, StochasticPolicy, ValuePolicy
label_desc: Use image node_id 7 for calling the ParametrizedDistributions obj's underlying member method code with example usage: obj.act_entropy() and returns: self, actions,  internals,  entropy, mode,  entropy, self, self, tf, sample,  entropy, sample,  entropy