class_docstr: Bernoulli distribution, for binary boolean actions (specification key: `bernoulli`).
  
  Args:
      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: ["Bernoulli","distribution",",","for","binary","boolean","actions","(","specification","key",":","`","bernoulli","`",")",".","Args",":","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 __init__(self, *, name=None, action_spec=None, input_spec=None):
      assert action_spec.type == "bool"
  
      parameters_spec = TensorsSpec(
          true_logit=TensorSpec(type="float", shape=action_spec.shape),
          false_logit=TensorSpec(type="float", shape=action_spec.shape),
          probability=TensorSpec(type="float", shape=action_spec.shape),
          state_value=TensorSpec(type="float", shape=action_spec.shape),
      )
      conditions_spec = TensorsSpec()
  
      super().__init__(
          name=name,
          action_spec=action_spec,
          input_spec=input_spec,
          parameters_spec=parameters_spec,
          conditions_spec=conditions_spec,
      )
  
      if self.input_spec.rank == 1:
          # Single embedding
          action_size = util.product(xs=self.action_spec.shape, empty=0)
          self.logit = self.submodule(
              name="logit",
              module="linear",
              modules=layer_modules,
              size=action_size,
              initialization_scale=0.01,
              input_spec=self.input_spec,
          )
  
      else:
          # Embedding per action
          if self.input_spec.rank < 1 or self.input_spec.rank > 3:
              raise TensorforceError.value(
                  name=name,
                  argument="input_spec.shape",
                  value=self.input_spec.shape,
                  hint="invalid rank",
              )
          if self.input_spec.shape[:-1] == self.action_spec.shape[:-1]:
              size = self.action_spec.shape[-1]
          elif self.input_spec.shape[:-1] == self.action_spec.shape:
              size = 0
          else:
              raise TensorforceError.value(
                  name=name,
                  argument="input_spec.shape",
                  value=self.input_spec.shape,
                  hint="not flattened and incompatible with action shape",
              )
          self.logit = self.submodule(
              name="logit",
              module="linear",
              modules=layer_modules,
              size=size,
              initialization_scale=0.01,
              input_spec=self.input_spec,
          )
  
file_path: tensorforce/tensorforce/core/distributions/bernoulli.py
imports: 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 1 to create a new Bernoulli object from inherited base classes: Distribution with example: obj = Bernoulli()