embedding.go 232 B

1234567891011
  1. package nn
  2. import "github.com/ollama/ollama/ml"
  3. type Embedding struct {
  4. Weight ml.Tensor `gguf:"weight"`
  5. }
  6. func (m *Embedding) Forward(ctx ml.Context, hiddenState ml.Tensor) ml.Tensor {
  7. return m.Weight.Rows(ctx, hiddenState)
  8. }