Embedding Bag
class EmbeddingBag(trainableWeights: TrainableTensor, reduction: EmbeddingBag.Companion.Reduction) : TrainableLayer<EmbeddingBag>
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
reduction
the reduction mode used to reduce each bag
This layer is equivalent to Embedding followed by a reduction (e.g. sum) across each bag of embeddings along the 0th axis.
Constructors
EmbeddingBag
Link copied to clipboard
fun EmbeddingBag(numEmbeddings: Int, embeddingSize: Int, reduction: EmbeddingBag.Companion.Reduction, random: Random, initializer: (Shape, Random) -> FloatTensor = Initializer.gaussian())
Content copied to clipboard
EmbeddingBag
Link copied to clipboard
fun EmbeddingBag(trainableWeights: TrainableTensor, reduction: EmbeddingBag.Companion.Reduction)
Content copied to clipboard
Types
Functions
cpu
Link copied to clipboard
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.
gpu
Link copied to clipboard
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): EmbeddingBag
Content copied to clipboard
with Trainables
Link copied to clipboard
open override fun withTrainables(trainables: List<Trainable<*>>): EmbeddingBag
Content copied to clipboard
wrap
Link copied to clipboard
The wrap function should return the same static type it is declared on.
Properties
reduction
Link copied to clipboard
trainables
Link copied to clipboard
trainableWeights
Link copied to clipboard