INNER CODE UNIT · Go
DotProductParallel
takara-ai/go-attention · attention/attention.go:70
func DotProductParallel(v1, v2 Vector, config interface{}) (float64, error) {
return DotProduct(v1, v2)
}
// Deprecated: Use DotProduct instead.
func DotProductOptimized(v1, v2 Vector) (float64, error) {
return DotProduct(v1, v2)
}
// Softmax applies the softmax function to a vector
// Performance: O(n) where n=len(x)
func Softmax(x Vector) Vector {
if len(x) == 0 {
return Vector{}
}
maxVal := x[0]
// Find max value for numerical stability