bartencoder

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: 12 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
	FFN                    *stack.Model
	LayerNorm              *layernorm.Model
}

Layer implements a BART encoder layer.

func NewLayer

func NewLayer(config bartconfig.Config) *Layer

NewLayer returns a new BART encoder Layer.

func (*Layer) Forward

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

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

type Model

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

Model implements a BART encoder.

func New

func New(config bartconfig.Config) *Model

New returns a new BART encoder Model.

func (*Model) Encode

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

Encode performs the forward step for each input node and returns the result.

Jump to

Keyboard shortcuts

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