tflearn.layers.embedding_ops.embedding (incoming, input_dim, output_dim, validate_indices=False, weights_init='truncated_normal', trainable=True, restore=True, reuse=False, scope=None, name='Embedding')

Embedding layer for a sequence of integer ids or floats.


2-D Tensor [samples, ids].


3-D Tensor [samples, embedded_ids, features].


  • incoming: Incoming 2-D Tensor.
  • input_dim: list of int. Vocabulary size (number of ids).
  • output_dim: list of int. Embedding size.
  • validate_indices: bool. Whether or not to validate gather indices.
  • weights_init: str (name) or Tensor. Weights initialization. (see tflearn.initializations) Default: 'truncated_normal'.
  • trainable: bool. If True, weights will be trainable.
  • restore: bool. If True, this layer weights will be restored when loading a model
  • reuse: bool. If True and 'scope' is provided, this layer variables will be reused (shared).
  • scope: str. Define this layer scope (optional). A scope can be used to share variables between layers. Note that scope will override name.
  • name: A name for this layer (optional). Default: 'Embedding'.