Class EmbeddingBag

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

public final class EmbeddingBag extends Module
EmbeddingBag: bags of INT32 indices (one flat list plus bag offsets) to the sum, mean or max of their embedding rows, PyTorch's nn.EmbeddingBag with standard normal initial weights.
  • Constructor Details

    • EmbeddingBag

      public EmbeddingBag(int count, int dim, F.BagMode mode, long seed)
      A table of count vectors of size dim, standard normal from seed, whose bags combine as mode says.
  • Method Details

    • weight

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

      public Tensor forward(Tensor indices, int[] offsets)
      One row per bag: bag b covers indices offsets[b] .. offsets[b + 1] - 1.
    • forward

      public Tensor forward(Tensor indices)
      Every index its own bag.
      Specified by:
      forward in class Module