bartdecoder

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2021 License: BSD-2-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Layer

type Layer struct {
	nn.BaseModel
	Config                    bartconfig.Config
	SelfAttention             *multiheadattention.Model
	SelfAttentionLayerNorm    *layernorm.Model
	EncoderAttention          *multiheadattention.Model
	EncoderAttentionLayerNorm *layernorm.Model
	FFN                       *stack.Model
	LayerNorm                 *layernorm.Model
}

Layer implements a BART decoder layer.

func NewLayer

func NewLayer(config bartconfig.Config) *Layer

NewLayer returns a new BART decoder Layer.

func (*Layer) Forward

func (m *Layer) Forward(xs, encoderHiddenStates []ag.Node) []ag.Node

Forward performs the forward step for each input and returns the result. Valid input type: LayerInput.

type Model

type Model struct {
	nn.BaseModel
	Config                      bartconfig.Config
	LearnedPositionalEmbeddings *posembeddings.LearnedPositionalEmbeddings
	Layers                      []*Layer
	EmbeddingLayerNorm          *layernorm.Model
	LayerNorm                   *layernorm.Model
}

Model implements a BART decoder.

func New

func New(config bartconfig.Config) *Model

New returns a new BART decoder Model.

func (*Model) Decode

func (m *Model) Decode(xs, encoderHiddenStates []ag.Node) []ag.Node

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

Jump to

Keyboard shortcuts

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