startransformer

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: 7 Imported by: 0

Documentation

Overview

Package startransformer provides a variant implementation of the Star-Transformer model introduced by Qipeng Guo, Xipeng Qiu et al. in "Star-Transformer", 2019 (https://www.aclweb.org/anthology/N19-1133.pdf). In this implementation, the Scaled Dot Product Attention is replaced by a Linear Attention.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	InputSize int
	QuerySize int
	KeySize   int
	ValueSize int
	Steps     int
}

Config provides configuration settings for a Star-Transformer Model.

type Model

type Model struct {
	nn.BaseModel
	Config
	Query         *linear.Model
	Key           *linear.Model
	Value         *linear.Model
	RelayQuery    *linear.Model
	RelayKey      *linear.Model
	RelayValue    *linear.Model
	SatelliteNorm *layernorm.Model
	RelayNorm     *layernorm.Model
}

Model contains the serializable parameters.

func New

func New(config Config) *Model

New returns a new model with parameters initialized to zeros.

func (*Model) Forward added in v0.2.0

func (m *Model) Forward(xs ...ag.Node) []ag.Node

Forward performs the forward step returns the results.

Jump to

Keyboard shortcuts

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