oa::FnMatrix::gruCellPointwise

gruCellPointwise: fused GRU pointwise forward. r = sigmoid(gatesI[r] + gatesH[r]) z = sigmoid(gatesI[z] + gatesH[z]) n = tanh(gatesI[n] + r * gatesH[n]) h_new = (1 - z) * n + z * hPrev

Function Documentation

Matrix oa::FnMatrix::gruCellPointwise( const Matrix & inGatesI, const Matrix & inGatesH, const Matrix & inHidden, oa::I32 inHiddenSize, oa::U32 inTimeOffset = 0, oa::U32 inBatchStride = 1 )
gruCellPointwise: fused GRU pointwise forward. r = sigmoid(gatesI[r] + gatesH[r]) z = sigmoid(gatesI[z] + gatesH[z]) n = tanh(gatesI[n] + r * gatesH[n]) h_new = (1 - z) * n + z * hPrev

Parameters

inGatesI
const Matrix &

[B, 3H] input projection (reset|update|candidate along dim 1) or [B*T, 3H] with inTimeOffset = t*B to index row t without Slice

inGatesH
const Matrix &

[B, 3H] hidden projection

inHidden
const Matrix &

[B, H] previous hidden state

inHiddenSize
oa::I32

H

inTimeOffset
oa::U32

row offset into inGatesI (in units of 3H), default 0

inBatchStride
oa::U32

Default: 1

Returns

Matrix

The declared return value.