lstmsc

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

Documentation

Overview

LSTM enriched with a PolicyGradient to enable Dynamic Skip Connections.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

type Model struct {
	PolicyGradient *stack.Model
	Lambda         float64
	WIn            *nn.Param `type:"weights"`
	WInRec         *nn.Param `type:"weights"`
	BIn            *nn.Param `type:"biases"`
	WOut           *nn.Param `type:"weights"`
	WOutRec        *nn.Param `type:"weights"`
	BOut           *nn.Param `type:"biases"`
	WFor           *nn.Param `type:"weights"`
	WForRec        *nn.Param `type:"weights"`
	BFor           *nn.Param `type:"biases"`
	WCand          *nn.Param `type:"weights"`
	WCandRec       *nn.Param `type:"weights"`
	BCand          *nn.Param `type:"biases"`
}

Model contains the serializable parameters.

func New

func New(in, out, k int, lambda float64, intermediate int) *Model

New returns a new model with parameters initialized to zeros. Lambda is the coefficient used in the equation λa + (1 − λ)b where 'a' is state[t-k] and 'b' is state[t-1].

func (*Model) NewProc

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

NewProc returns a new processor to execute the forward step.

type Processor

type Processor struct {
	nn.BaseProcessor

	PolicyGradient *stack.Processor

	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) PolicyGradientLogProbActions

func (p *Processor) PolicyGradientLogProbActions() []ag.Node

func (*Processor) SetInitialState

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

type State

type State struct {
	InG       ag.Node
	OutG      ag.Node
	ForG      ag.Node
	Cand      ag.Node
	Cell      ag.Node
	Y         ag.Node
	Actions   ag.Node
	SkipIndex int
}

Jump to

Keyboard shortcuts

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