Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Model ¶
type Model struct { nn.Module UseRefinedGates bool // Input gate WIn nn.Param `spago:"type:weights"` WInRec nn.Param `spago:"type:weights"` BIn nn.Param `spago:"type:biases"` // Output gate WOut nn.Param `spago:"type:weights"` WOutRec nn.Param `spago:"type:weights"` BOut nn.Param `spago:"type:biases"` // Forget gate WFor nn.Param `spago:"type:weights"` WForRec nn.Param `spago:"type:weights"` BFor nn.Param `spago:"type:biases"` // Candiate gate WCand nn.Param `spago:"type:weights"` WCandRec nn.Param `spago:"type:weights"` BCand nn.Param `spago:"type:biases"` }
Model contains the serializable parameters.
func (*Model) Forward ¶
Forward performs the forward step for each input node and returns the result.
func (*Model) Next ¶
Next performs a single forward step, producing a new state.
It computes the results with the following equations: inG = sigmoid(wIn (dot) x + bIn + wInRec (dot) yPrev) outG = sigmoid(wOut (dot) x + bOut + wOutRec (dot) yPrev) forG = sigmoid(wFor (dot) x + bFor + wForRec (dot) yPrev) cand = f(wCand (dot) x + bC + wCandRec (dot) yPrev) cell = inG * cand + forG * cellPrev y = outG * f(cell)
func (*Model) WithRefinedGates ¶
WithRefinedGates sets whether to use refined gates. Refined Gate: A Simple and Effective Gating Mechanism for Recurrent Units (https://arxiv.org/pdf/2002.11338.pdf)
Refined gates setting requires input size and output size be the same.