class_docstr: Embedding layer (specification key: `embedding`).
  
  Args:
      size (int >= 0): Layer output size, 0 implies additionally removing the axis
          (<span style="color:#C00000"><b>required</b></span>).
      num_embeddings (int > 0): If set, specifies the number of embeddings
          (<span style="color:#00C000"><b>default</b></span>: none).
      max_norm (float): If set, embeddings are clipped if their L2-norm is larger
          (<span style="color:#00C000"><b>default</b></span>: none).
      bias (bool): Whether to add a trainable bias variable
          (<span style="color:#00C000"><b>default</b></span>: true).
      activation ('crelu' | 'elu' | 'leaky-relu' | 'none' | 'relu' | 'selu' | 'sigmoid' |
          'softmax' | 'softplus' | 'softsign' | 'swish' | 'tanh'): Activation nonlinearity
          (<span style="color:#00C000"><b>default</b></span>: tanh).
      dropout (parameter, 0.0 <= float < 1.0): Dropout rate
          (<span style="color:#00C000"><b>default</b></span>: 0.0).
      vars_trainable (bool): Whether layer variables are trainable
          (<span style="color:#00C000"><b>default</b></span>: true).
      l2_regularization (float >= 0.0): Scalar controlling L2 regularization
          (<span style="color:#00C000"><b>default</b></span>: inherit value of parent module).
      name (string): Layer name
          (<span style="color:#00C000"><b>default</b></span>: internally chosen).
      input_spec (specification): <span style="color:#00C000"><b>internal use</b></span>.
class_docstr_tok: ["Embedding","layer","(","specification","key",":","`","embedding","`",")",".","Args",":","size","(","int",">","=","0",")",":","Layer","output","size",",","0","implies","additionally","removing","the","axis","(","<","span","style=","''","color",":","#","C00000","''",">","<","b",">","required","<","\/b",">","<","\/span",">",")",".","num_embeddings","(","int",">","0",")",":","If","set",",","specifies","the","number","of","embeddings","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","none",")",".","max_norm","(","float",")",":","If","set",",","embeddings","are","clipped","if","their","L2-norm","is","larger","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","none",")",".","bias","(","bool",")",":","Whether","to","add","a","trainable","bias","variable","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","true",")",".","activation","(","'crelu","'","|","'elu","'","|","'leaky-relu","'","|","'none","'","|","'relu","'","|","'selu","'","|","'sigmoid","'","|","'softmax","'","|","'softplus","'","|","'softsign","'","|","'swish","'","|","'tanh","'",")",":","Activation","nonlinearity","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","tanh",")",".","dropout","(","parameter",",","0.0","<","=","float","<","1.0",")",":","Dropout","rate","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","0.0",")",".","vars_trainable","(","bool",")",":","Whether","layer","variables","are","trainable","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","true",")",".","l2_regularization","(","float",">","=","0.0",")",":","Scalar","controlling","L2","regularization","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","inherit","value","of","parent","module",")",".","name","(","string",")",":","Layer","name","(","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","default","<","\/b",">","<","\/span",">",":","internally","chosen",")",".","input_spec","(","specification",")",":","<","span","style=","''","color",":","#","00C000","''",">","<","b",">","internal","use","<","\/b",">","<","\/span",">","."]
code: def initialize(self):
      super().initialize()
  
      if self.num_embeddings is None:
          if self.input_spec.type == "bool":
              if self.num_embeddings is None:
                  self.num_embeddings = 2
  
          elif self.input_spec.type == "int":
              if self.num_embeddings is None:
                  self.num_embeddings = self.input_spec.num_values
  
              if self.num_embeddings is None:
                  raise TensorforceError.required(
                      name="Embedding",
                      argument="num_embeddings",
                      condition="input num_values is None",
                  )
              elif (
                  self.input_spec.num_values is not None
                  and self.num_embeddings < self.input_spec.num_values
              ):
                  raise TensorforceError.required(
                      name="Embedding",
                      argument="num_embeddings",
                      expected=">= input num_values",
                  )
  
          self.architecture_kwargs["num_embeddings"] = str(
              self.num_embeddings
          )
  
      initializer = "normal"
      if (
          self.activation is not None
          and self.activation.nonlinearity == "relu"
      ):
          initializer += "-relu"
  
      self.weights = self.variable(
          name="embeddings",
          spec=TensorSpec(
              type="float", shape=(self.num_embeddings, self.size)
          ),
          initializer=initializer,
          is_trainable=self.vars_trainable,
          is_saved=True,
      )
  
file_path: tensorforce/tensorforce/core/layers/embedding.py
imports: import tensorflow
  from tensorforce import TensorforceError
  from tensorforce.core import TensorSpec, tf_function, tf_util
  from tensorforce.core.layers import TransformationBase
label_desc: Use image node_id 4 for calling the Embedding obj's underlying member method code with example usage: obj.initialize() without return types