vectorutil

package
v0.6.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArgMax

func ArgMax(s []float32) (int, float32, error)

ArgMax find both index of max value in s and max value.

func Mean

func Mean(vector []float32) float32

Mean of a float32 vector.

func Norm

func Norm(v []float32, p int) float64

Norm of a vector.

func Normalize

func Normalize(embedding []float32, p int) []float32

Normalize single vector according to: https://pytorch.org/docs/stable/generated/torch.nn.functional.normalize.html

func Sigmoid

func Sigmoid(s []float32) []float32

func SoftMax

func SoftMax(vector []float32) []float32

SoftMax take a vector and calculate softmax scores of its values.

func SumSlice

func SumSlice(s []float64) float64

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL