Embedding
class Embedding(trainableWeights: TrainableTensor) : TrainableLayer<Embedding>
Content copied to clipboard
A trainable embedding table with size vocabSize x embeddingSize
Parameters
num Embeddings
the size of the vocabulary/number of embedding vectors
embedding Size
the size of each embedding vector
Accepts a tensor of Shape() and returns a tensor of Shape(, embeddingSize)
Constructors
Functions
extract Tangent
Link copied to clipboard
open override fun extractTangent(output: DTensor, extractor: (DTensor, DTensor) -> DTensor): TrainableComponent.Companion.Tangent
Content copied to clipboard
get Single Input
Link copied to clipboard
Helper to check that the layer was called with a single input. Returns that input if successful, else errors.
load
Link copied to clipboard
store
Link copied to clipboard
training Step
Link copied to clipboard
open override fun trainingStep(optim: Optimizer<*>, tangent: Trainable.Tangent): Embedding
Content copied to clipboard
with Trainables
Link copied to clipboard
open override fun withTrainables(trainables: List<Trainable<*>>): Embedding
Content copied to clipboard