Class Embedding

java.lang.Object
ai.beestream.jitnn.nn.Module
ai.beestream.jitnn.nn.Embedding
All Implemented Interfaces:
AutoCloseable

public final class Embedding extends Module
A lookup table of count vectors of size dim, applied to INT32 indices. Initialised like PyTorch's nn.Embedding: standard normal entries.
  • Constructor Details

    • Embedding

      public Embedding(int count, int dim, long seed)
      A table of count vectors of size dim, standard normal from seed, every row trained.
    • Embedding

      public Embedding(int count, int dim, int paddingIdx, long seed)
      Row paddingIdx receives no gradient (pass -1 for none).
    • Embedding

      public Embedding(Tensor init, int paddingIdx)
      An embedding with the given initial table [count, dim].
  • Method Details

    • weight

      public Tensor weight()
      The table [count, dim].
    • forward

      public Tensor forward(Tensor index)
      Description copied from class: Module
      Applies the module to x.
      Specified by:
      forward in class Module