class_docstr: Gaussian distribution, for continuous actions (specification key: `gaussian`).
  
  Args:
      stddev_mode ("predicted" | "global"): Whether to predict the standard deviation via a linear
          transformation of the state embedding, or to parametrize the standard deviation by a
          separate set of trainable weights
          (<span style="color:#00C000"><b>default</b></span>: "predicted").
      bounded_transform ("clipping" | "tanh"): Transformation to adjust sampled actions in case of
          bounded action space, "tanh" transforms distribution (e.g. log probability computation)
          accordingly whereas "clipping" does not
          (<span style="color:#00C000"><b>default</b></span>: tanh).
      name (string): <span style="color:#0000C0"><b>internal use</b></span>.
      action_spec (specification): <span style="color:#0000C0"><b>internal use</b></span>.
      input_spec (specification): <span style="color:#0000C0"><b>internal use</b></span>.
class_docstr_tok: ["Gaussian","distribution",",","for","continuous","actions","(","specification","key",":","`","gaussian","`",")",".","Args",":","stddev_mode","(","``","predicted","''","|","``","global","''",")",":","Whether","to","predict","the","standard","deviation","via","a","linear","transformation","of","the","state","embedding",",","or","to","parametrize","the","standard","deviation","by","a","separate","set","of","trainable","weights","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","``","predicted","''",")",".","bounded_transform","(","``","clipping","''","|","``","tanh","''",")",":","Transformation","to","adjust","sampled","actions","in","case","of","bounded","action","space",",","``","tanh","''","transforms","distribution","(","e.g",".","log","probability","computation",")","accordingly","whereas","``","clipping","''","does","not","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","tanh",")",".","name","(","string",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">",".","action_spec","(","specification",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">",".","input_spec","(","specification",")",":","<","span","style=","''","color",":","#","0000C0","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">","."]
code: def sample(self, *, parameters, temperature, independent):
      mean, stddev = parameters.get(("mean", "stddev"))
  
      # Distribution parameter summaries and tracking
      dependencies = list()
      if not independent:
  
          def fn_summary():
              m = tf.math.reduce_mean(
                  input_tensor=mean,
                  axis=range(self.action_spec.rank + 1),
              )
              s = tf.math.reduce_mean(
                  input_tensor=stddev,
                  axis=range(self.action_spec.rank + 1),
              )
              return m, s
  
          prefix = "distributions/" + self.name
          names = (prefix + "-mean", prefix + "-stddev")
          dependencies.extend(
              self.summary(
                  label="distribution",
                  name=names,
                  data=fn_summary,
                  step="timesteps",
              )
          )
  
      # Distribution parameter tracking
      def fn_tracking():
          return tf.math.reduce_mean(input_tensor=mean, axis=0)
  
      dependencies.extend(
          self.track(
              label="distribution", name="mean", data=fn_tracking
          )
      )
  
      def fn_tracking():
          return tf.math.reduce_mean(input_tensor=stddev, axis=0)
  
      dependencies.extend(
          self.track(
              label="distribution", name="stddev", data=fn_tracking
          )
      )
  
      def fn_mode():
          return mean
  
      def fn_sample():
          normal_distribution = tf.random.normal(
              shape=tf.shape(input=mean),
              dtype=tf_util.get_dtype(type="float"),
          )
          return mean + stddev * temperature * normal_distribution
  
      with tf.control_dependencies(control_inputs=dependencies):
          epsilon = tf_util.constant(value=util.epsilon, dtype="float")
          action = tf.cond(
              pred=(temperature < epsilon),
              true_fn=fn_mode,
              false_fn=fn_sample,
          )
  
          # Bounded transformation
          if self.bounded_transform is not None:
              one = tf_util.constant(value=1.0, dtype="float")
  
              if self.bounded_transform == "tanh":
                  action = tf.math.tanh(x=action)
              elif self.bounded_transform == "clipping":
                  action = tf.clip_by_value(
                      t=action, clip_value_min=-one, clip_value_max=one
                  )
  
              if (
                  self.action_spec.min_value is not None
                  and self.action_spec.max_value is not None
              ):
                  half = tf_util.constant(value=0.5, dtype="float")
                  min_value = tf_util.constant(
                      value=self.action_spec.min_value, dtype="float"
                  )
                  max_value = tf_util.constant(
                      value=self.action_spec.max_value, dtype="float"
                  )
                  action = min_value + (
                      max_value - min_value
                  ) * half * (action + one)
  
              elif self.action_spec.min_value is not None:
                  min_value = tf_util.constant(
                      value=self.action_spec.min_value, dtype="float"
                  )
                  action = tf.maximum(x=min_value, y=action)
              else:
                  assert self.action_spec.max_value is not None
                  max_value = tf_util.constant(
                      value=self.action_spec.max_value, dtype="float"
                  )
                  action = tf.minimum(x=max_value, y=action)
  
          return action
  
file_path: tensorforce/tensorforce/core/distributions/gaussian.py
imports: import numpy
  import tensorflow
  from tensorforce import TensorforceError, util
  from tensorforce.core import layer_modules, TensorDict, TensorSpec, TensorsSpec, tf_function, tf_util
  from tensorforce.core.distributions import Distribution
label_desc: Use image node_id 6 for calling the Gaussian obj's underlying member method code with example usage: obj.sample() and returns: tf, tf, mean, unknown, action, m,  s