pe

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2021 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SinusoidalPositionalEncoder added in v0.5.0

type SinusoidalPositionalEncoder struct {
	// Size is the encoding vector size.
	Size int
	// Length is the max number of positions.
	Length int
	// Vectors contains the pre-computed encoding.
	Vectors []mat.Matrix
}

SinusoidalPositionalEncoder uses the sine and cosine functions of different frequencies to compose position embeddings so to incorporate a notion of word order in non-recurrent models (Vaswani et al., 2017).

func NewSinusoidalPositionalEncoder added in v0.5.0

func NewSinusoidalPositionalEncoder(size, length int) *SinusoidalPositionalEncoder

NewSinusoidalPositionalEncoder returns a new SinusoidalPositionalEncoder ready to use.

func (*SinusoidalPositionalEncoder) Encode added in v0.5.0

func (r *SinusoidalPositionalEncoder) Encode(xs ...int) []mat.Matrix

Encode returns the positional encoding for the given positions.

Jump to

Keyboard shortcuts

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