Show / Hide Table of Contents

Class Embedding

Turns positive integers (indexes) into dense vectors of fixed size. eg. [[4], [20]] -> [[0.25, 0.1], [0.6, -0.2]] This layer can only be used as the first layer in a model.

Inheritance
System.Object
Keras
Base
BaseLayer
Embedding
Implements
System.IDisposable
Inherited Members
BaseLayer.Set(BaseLayer[])
Base.Parameters
Base.None
Base.Init()
Base.ToPython()
Base.InvokeStaticMethod(Object, String, Dictionary<String, Object>)
Base.InvokeMethod(String, Dictionary<String, Object>)
Base.Item[String]
Keras.Instance
Keras.keras
Keras.keras2onnx
Keras.tfjs
Keras.Dispose()
Keras.ToTuple(Array)
Keras.ToList(Array)
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Keras.Layers
Assembly: Keras.dll
Syntax
public class Embedding : BaseLayer, IDisposable

Constructors

| Improve this Doc View Source

Embedding(Int32, Int32, String, String, String, String, Boolean, Nullable<Int32>, Shape)

Initializes a new instance of the Embedding class.

Declaration
public Embedding(int input_dim, int output_dim, string embeddings_initializer = "uniform", string embeddings_regularizer = "", string activity_regularizer = "", string embeddings_constraint = "", bool mask_zero = false, int? input_length = default(int? ), Shape input_shape = null)
Parameters
Type Name Description
System.Int32 input_dim

int > 0. Size of the vocabulary, i.e. maximum integer index + 1.

System.Int32 output_dim

int >= 0. Dimension of the dense embedding.

System.String embeddings_initializer

Initializer for the embeddings matrix (see initializers).

System.String embeddings_regularizer

Regularizer function applied to the embeddings matrix (see regularizer).

System.String activity_regularizer

Regularizer function applied to the output of the layer (its "activation"). (see regularizer).

System.String embeddings_constraint

Constraint function applied to the embeddings matrix (see constraints).

System.Boolean mask_zero

Whether or not the input value 0 is a special "padding" value that should be masked out. This is useful when using recurrent layers which may take variable length input. If this is True then all subsequent layers in the model need to support masking or an exception will be raised. If mask_zero is set to True, as a consequence, index 0 cannot be used in the vocabulary (input_dim should equal size of vocabulary + 1).

System.Nullable<System.Int32> input_length

Length of input sequences, when it is constant. This argument is required if you are going to connect Flatten then Dense layers upstream (without it, the shape of the dense outputs cannot be computed).

Shape input_shape

2D tensor with shape: (batch_size, sequence_length).

Implements

System.IDisposable
  • Improve this Doc
  • View Source
Back to top Generated by DocFX