vkML 0.1.0

Embedding

A lookup table mapping integer indices to dense vectors.

class Embedding : Modulepython/vkml/nn.py:604

Implemented as an index_select over the weight, so its gradient is a scatter_add back into a zero tensor — which is why scatter_add's determinism matters for training a model with an embedding, not only for inference.

Construction

__init__

def __init__self, num_embeddings: int, embedding_dim: intpython/vkml/nn.py:612

Forward

forward

def forwardself, indices: V.Tensor -> V.Tensorpython/vkml/nn.py:620

Internals

__repr__

def __repr__self -> strpython/vkml/nn.py:628

See also index_select, scatter_add, PositionalEncoding, Module

vkML — Vulkan-first machine learning in C++20. Apache-2.0. Signatures on this page are generated from the installed module.