refactor rope

change to a flatter directory structure and group the options with the
function

update models to call rope in one place
This commit is contained in:
Michael Yang
2025-11-18 15:17:03 -08:00
committed by Michael Yang
parent e082d60a24
commit 603ceefaa6
21 changed files with 114 additions and 91 deletions

View File

@@ -1,5 +1,4 @@
// fast provides implementations of fast (fused) operations for increased performance.
package fast
package nn
import (
"github.com/ollama/ollama/ml"
@@ -8,7 +7,7 @@ import (
// fastRoPE is an interface for tensors that support fast rotary positional embedding.
type fastRoPE interface {
RoPE(ctx ml.Context, positionIDs ml.Tensor, dim int, base, scale float32, options ...func(*rope.Options)) ml.Tensor
RoPE(ctx ml.Context, positions ml.Tensor, dim int, base, scale float32, options ...func(*rope.Options)) ml.Tensor
}
// RoPE applies rotary positional embedding to tensor `t`.

View File

@@ -1,3 +1,4 @@
// Package rope provides options for RoPE
package rope
import "github.com/ollama/ollama/ml"