f32

package
v0.0.0-...-41d7962 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// StateM is the state for the mean
	StateM = iota
	// StateV is the state for the variance
	StateV
	// StateTotal is the total number of states
	StateTotal
)
View Source
const (
	// S is the scaling factor for the softmax
	S = 1.0 - 1e-300
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Matrix

type Matrix struct {
	Cols   int
	Rows   int
	Data   []float32
	States [][]float32
}

Matrix is a float32 matrix

func Add

func Add(m Matrix, n Matrix) Matrix

Add adds two float32 matrices

func EverettActivation

func EverettActivation(m Matrix) Matrix

EverettActivation is the everett complex activation function

func MulT

func MulT(m Matrix, n Matrix) Matrix

MulT multiplies two matrices and computes the transpose

func NewMatrix

func NewMatrix(states, cols, rows int) Matrix

NewMatrix32 creates a new float32 matrix

func Normalize

func Normalize(m Matrix) Matrix

Normalize normalizes a matrix to the unit vector

func SelfAttention

func SelfAttention(Q, K, V Matrix) Matrix

SelfAttention computes the self attention of Q, K, V

func Sigmoid

func Sigmoid(m Matrix) Matrix

Sigmoid computes the sigmoid of a matrix

func Step

func Step(m Matrix) Matrix

Step computes the step function of a float32 matrix

func T

func T(m Matrix) Matrix

T tramsposes a matrix

func TaylorSoftmax

func TaylorSoftmax(m Matrix) Matrix

TaylorSoftmax is the taylor softmax https://arxiv.org/abs/1511.05042

func (Matrix) Size

func (m Matrix) Size() int

Size is the size of the float32 matrix

type Multi

type Multi struct {
	A Matrix
	U []float32
}

Multi is a multivariate distribution

func Factor

func Factor(vars [][]float32, debug bool) Multi

Factor factores a matrix into AA^T

func (Multi) Sample

func (m Multi) Sample(rng *rand.Rand) []float32

Sample samples from the multivariate distribution

Jump to

Keyboard shortcuts

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