oa::GruCell

GruCell class in the OA Ml public surface.

Inheritance

public Module

Public Methods

oa::Matrix oa::GruCell::forward(const oa::Matrix & inInput)
oa::I32 oa::GruCell::hiddenSize()
oa::Matrix oa::GruCell::inputProjection(const oa::Matrix & inInput)
oa::I32 oa::GruCell::inputSize()
oa::Matrix oa::GruCell::step(const oa::Matrix & inInput, const oa::Matrix & inHidden)
oa::Matrix oa::GruCell::stepWithGatesI(const oa::Matrix & inGatesI, const oa::Matrix & inHidden, oa::U32 inTimeOffset = 0, oa::U32 inBatchStride = 1)
oa::Matrix oa::GruCell::zeroState(oa::I32 inBatch)

Constructor & Destructor Documentation

oa::GruCell::GruCell( oa::I32 inInputSize, oa::I32 inHiddenSize, bool inBias = true )
No public source comment is attached to this declaration.

Parameters

inInputSize
oa::I32

inHiddenSize
oa::I32

inBias
bool

Default: true

Public Method Documentation

oa::Matrix oa::GruCell::forward( const oa::Matrix & inInput )
No public source comment is attached to this declaration.

Parameters

inInput
const oa::Matrix &

Returns

oa::Matrix

The declared return value.

oa::I32 oa::GruCell::hiddenSize()
No public source comment is attached to this declaration.

Returns

oa::I32

The declared return value.

oa::Matrix oa::GruCell::inputProjection( const oa::Matrix & inInput )
split projections so Gru can hoist the (recurrence-free) input projection out of the timestep loop into one batched GEMM. inputProjection: gatesI = Linear(x, W_ih, b_ih) for any row count → [*, 3H]. stepWithGatesI: consumes a precomputed gatesI [B*T, 3H] at row offset timeOffset and runs only the recurrent gatesH + pointwise.

Parameters

inInput
const oa::Matrix &

Returns

oa::Matrix

The declared return value.

oa::I32 oa::GruCell::inputSize()
No public source comment is attached to this declaration.

Returns

oa::I32

The declared return value.

oa::Matrix oa::GruCell::step( const oa::Matrix & inInput, const oa::Matrix & inHidden )
No public source comment is attached to this declaration.

Parameters

inInput
const oa::Matrix &

inHidden
const oa::Matrix &

Returns

oa::Matrix

The declared return value.

oa::Matrix oa::GruCell::stepWithGatesI( const oa::Matrix & inGatesI, const oa::Matrix & inHidden, oa::U32 inTimeOffset = 0, oa::U32 inBatchStride = 1 )
No public source comment is attached to this declaration.

Parameters

inGatesI
const oa::Matrix &

inHidden
const oa::Matrix &

inTimeOffset
oa::U32

Default: 0

inBatchStride
oa::U32

Default: 1

Returns

oa::Matrix

The declared return value.

oa::Matrix oa::GruCell::zeroState( oa::I32 inBatch )
No public source comment is attached to this declaration.

Parameters

inBatch
oa::I32

Returns

oa::Matrix

The declared return value.