mirror of
https://github.com/ollama/ollama.git
synced 2025-05-17 06:55:09 +02:00
22 lines
460 B
Go
22 lines
460 B
Go
package nn
|
|
|
|
import (
|
|
"github.com/ollama/ollama/ml"
|
|
)
|
|
|
|
type LayerNorm struct {
|
|
Weight ml.Tensor `gguf:"weight"`
|
|
Bias ml.Tensor `gguf:"bias"`
|
|
}
|
|
|
|
func (m *LayerNorm) Forward(ctx ml.Context, t ml.Tensor, eps float32) ml.Tensor {
|
|
return t.LayerNorm(ctx, m.Weight, m.Bias, eps)
|
|
}
|
|
|
|
type RMSNorm struct {
|
|
Weight ml.Tensor `gguf:"weight"`
|
|
}
|
|
|
|
func (m *RMSNorm) Forward(ctx ml.Context, t ml.Tensor, eps float32) ml.Tensor {
|
|
return t.RMSNorm(ctx, m.Weight, eps)
|
|
}
|