oa::TransformerBlock
TransformerBlock class in the OA Ml public surface.
Inheritance
public Module
Public Methods
oa::Matrix oa::TransformerBlock::forwardConditioned(const oa::Matrix & inX, const oa::Matrix & inCondition, const oa::Matrix & inAdditiveMask = = {})oa::Matrix oa::TransformerBlock::forwardMasked(const oa::Matrix & inX, const oa::Matrix & inAdditiveMask)void oa::TransformerBlock::init(oa::I32 inDModel, oa::I32 inDFF, oa::I32 inSeqLen, oa::F32 inEps = 1e-5f)void oa::TransformerBlock::init(oa::I32 inDModel, oa::I32 inDFF, oa::I32 inSeqLen, oa::I32 inNumHeads, oa::F32 inEps)void oa::TransformerBlock::initMoe(oa::I32 inDModel, oa::I32 inExpertDFF, oa::I32 inSeqLen, oa::I32 inNumExperts, oa::I32 inExpertsPerToken, oa::F32 inEps = 1e-5f)Constructor & Destructor Documentation
No public source comment is attached to this declaration.
No public source comment is attached to this declaration.
Parameters
inDModeloa::I32—
inDFFoa::I32—
inSeqLenoa::I32—
inEpsoa::F32Default: 1e-5f
No public source comment is attached to this declaration.
Parameters
inDModeloa::I32—
inDFFoa::I32—
inSeqLenoa::I32—
inNumHeadsoa::I32—
inEpsoa::F32—
No public source comment is attached to this declaration.
Parameters
inDModeloa::I32—
inExpertDFFoa::I32—
inSeqLenoa::I32—
inNumExpertsoa::I32—
inExpertsPerTokenoa::I32—
inEpsoa::F32Default: 1e-5f
No public source comment is attached to this declaration.
Parameters
inDModeloa::I32—
inExpertDFFoa::I32—
inSeqLenoa::I32—
inNumHeadsoa::I32—
inNumExpertsoa::I32—
inExpertsPerTokenoa::I32—
inEpsoa::F32—
Public Method Documentation
No public source comment is attached to this declaration.
Returns
oa::AttentionModeThe declared return value.
No public source comment is attached to this declaration.
Returns
oa::I32The declared return value.
No public source comment is attached to this declaration.
Returns
oa::I32The declared return value.
Enables DiT-style AdaLN-Zero modulation. The ordinary language-model path remains unchanged until this is explicitly enabled by a conditioned model.
Parameters
inConditionDimoa::I32—
Returns
voidThe declared return value.
forward: x [B*S, D] → [B*S, D]. inSeqLen separates sequences within the flattened batch. Causal visibility remains the language-model default; flow/denoising encoders explicitly select Bidirectional.
Parameters
inXconst oa::Matrix &—
Returns
oa::MatrixThe declared return value.
No public source comment is attached to this declaration.
Parameters
inXconst oa::Matrix &—
inConditionconst oa::Matrix &—
inAdditiveMaskconst oa::Matrix &Default: = {}
Returns
oa::MatrixThe declared return value.
Same block with an explicit additive attention mask [B*H*S,S]. The mask is shared by language padding and bidirectional denoising; Flash attention is intentionally bypassed because its current kernel is causal-only.
Parameters
inXconst oa::Matrix &—
inAdditiveMaskconst oa::Matrix &—
Returns
oa::MatrixThe declared return value.
No public source comment is attached to this declaration.
Parameters
inDModeloa::I32—
inDFFoa::I32—
inSeqLenoa::I32—
inEpsoa::F32Default: 1e-5f
Returns
voidThe declared return value.
No public source comment is attached to this declaration.
Parameters
inDModeloa::I32—
inDFFoa::I32—
inSeqLenoa::I32—
inNumHeadsoa::I32—
inEpsoa::F32—
Returns
voidThe declared return value.
No public source comment is attached to this declaration.
Parameters
inDModeloa::I32—
inExpertDFFoa::I32—
inSeqLenoa::I32—
inNumExpertsoa::I32—
inExpertsPerTokenoa::I32—
inEpsoa::F32Default: 1e-5f
Returns
voidThe declared return value.
No public source comment is attached to this declaration.
Parameters
inDModeloa::I32—
inExpertDFFoa::I32—
inSeqLenoa::I32—
inNumHeadsoa::I32—
inNumExpertsoa::I32—
inExpertsPerTokenoa::I32—
inEpsoa::F32—
Returns
voidThe declared return value.
No public source comment is attached to this declaration.
Returns
boolThe declared return value.
No public source comment is attached to this declaration.
Returns
Moe *The declared return value.
No public source comment is attached to this declaration.
Returns
const Moe *The declared return value.
No public source comment is attached to this declaration.
Returns
oa::I32The declared return value.
No public source comment is attached to this declaration.
Returns
oa::I32The declared return value.
No public source comment is attached to this declaration.
Parameters
inModeoa::AttentionMode—
Returns
voidThe declared return value.
The weights are sequence-length independent. Updating the runtime length only changes the B/S view and its causal mask, which lets one block serve fixed-length training and growing-prefix autoregressive generation.
Parameters
inSeqLenoa::I32—
Returns
voidThe declared return value.