Package smile.deep.layer
Class EmbeddingLayer
java.lang.Object
smile.deep.layer.EmbeddingLayer
An embedding layer that is a simple lookup table that stores embeddings
of a fixed dictionary and size.
This layer is often used to store word embeddings and retrieve them using indices. The input to the module is a list of indices, and the output is the corresponding word embeddings.
-
Constructor Summary
ConstructorDescriptionEmbeddingLayer
(int numTokens, int dim) Constructor.EmbeddingLayer
(int numTokens, int dim, double alpha) Constructor. -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface smile.deep.layer.Layer
apply, isTraining
-
Constructor Details
-
EmbeddingLayer
public EmbeddingLayer(int numTokens, int dim) Constructor.- Parameters:
numTokens
- the size of the dictionary of embeddings.dim
- the size of each embedding vector.
-
EmbeddingLayer
public EmbeddingLayer(int numTokens, int dim, double alpha) Constructor.- Parameters:
numTokens
- the size of the dictionary of embeddings.dim
- the size of each embedding vector.alpha
- optional scaling factor.
-
-
Method Details