mirror of
https://github.com/Warky-Devs/vecna.git
synced 2026-05-05 01:26:58 +00:00
feat(adapter): add passthrough adapter for unchanged vectors
This commit is contained in:
@@ -41,6 +41,17 @@ type Adapter interface {
|
||||
TargetDim() int
|
||||
}
|
||||
|
||||
// passthroughAdapter returns the input vector unchanged.
|
||||
type passthroughAdapter struct{}
|
||||
|
||||
func (passthroughAdapter) Adapt(vec []float32) ([]float32, error) { return vec, nil }
|
||||
func (passthroughAdapter) SourceDim() int { return 0 }
|
||||
func (passthroughAdapter) TargetDim() int { return 0 }
|
||||
|
||||
// NewPassthrough returns an Adapter that returns vectors unchanged.
|
||||
// Use when no dimension adaptation is needed.
|
||||
func NewPassthrough() Adapter { return passthroughAdapter{} }
|
||||
|
||||
// NewTruncate returns a TruncateAdapter for Matryoshka-style or simple truncation/padding.
|
||||
// t controls which end is dropped when downscaling; p controls which end is padded when upscaling.
|
||||
func NewTruncate(sourceDim, targetDim int, t TruncateMode, p PadMode) (Adapter, error) {
|
||||
|
||||
Reference in New Issue
Block a user