INNER CODE UNIT · Go

DefaultEpsilon

takara-ai/go-attention · attention/attention.go:19

	DefaultEpsilon = 1e-5 // For numerical stability in softmax
)

// i is the representation of the query
// j is the representation of the key
// k is the representation of the value

// DotProduct computes the dot product of two vectors
// Performance: O(d) where d=len(v1)
func DotProduct(v1, v2 Vector) (float64, error) {
	return bestDotProduct(v1, v2)
}

// BestDotProduct is an alias for DotProduct for API clarity
func BestDotProduct(v1, v2 Vector) (float64, error) {
	return DotProduct(v1, v2)
}

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…