rla

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: BSD-2-Clause Imports: 4 Imported by: 0

Documentation

Overview

RLA (Recurrent Linear Attention) "Transformers are RNNs: Fast Autoregressive Transformers with Linear Attention" by Katharopoulos et al., 2020. TODO: support arbitrary mapping functions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	InputSize int
}

type Model

type Model struct {
	Config
	Wk *nn.Param `type:"weights"`
	Bk *nn.Param `type:"biases"`
	Wv *nn.Param `type:"weights"`
	Bv *nn.Param `type:"biases"`
	Wq *nn.Param `type:"weights"`
	Bq *nn.Param `type:"biases"`
}

func New

func New(config Config) *Model

func (*Model) NewProc

func (m *Model) NewProc(ctx nn.Context) nn.Processor

type Processor

type Processor struct {
	nn.BaseProcessor

	States []*State
	// contains filtered or unexported fields
}

func (*Processor) Forward

func (p *Processor) Forward(xs ...ag.Node) []ag.Node

Forward performs the forward step for each input and returns the result.

func (*Processor) LastState

func (p *Processor) LastState() *State

func (*Processor) SetInitialState

func (p *Processor) SetInitialState(state *State)

type State

type State struct {
	S ag.Node
	Z ag.Node
	Y ag.Node
}

Jump to

Keyboard shortcuts

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