pub struct FlowTransformer { /* private fields */ }Expand description
Reusable bidirectional Transformer backbone for flow/diffusion denoisers.
Implementations§
Source§impl FlowTransformer
impl FlowTransformer
pub fn new_with_seed(config: FlowTransformerConfig, seed: u64) -> Result<Self>
Sourcepub fn new_with_seed_on(
runtime: &Runtime,
config: FlowTransformerConfig,
seed: u64,
) -> Result<Self>
pub fn new_with_seed_on( runtime: &Runtime, config: FlowTransformerConfig, seed: u64, ) -> Result<Self>
Construct a deterministic dense or dropless-MoE flow Transformer.
§Errors
Returns an error for invalid geometry, expert routing, epsilon, or failed child construction and registration.
Sourcepub fn forward(&self, tokens: &Matrix) -> Result<Matrix>
pub fn forward(&self, tokens: &Matrix) -> Result<Matrix>
Apply the unmasked backbone to rank-two or rank-three token state.
Sourcepub fn forward_masked(
&self,
tokens: &Matrix,
token_mask: &Matrix,
) -> Result<Matrix>
pub fn forward_masked( &self, tokens: &Matrix, token_mask: &Matrix, ) -> Result<Matrix>
Apply the backbone with a binary key mask shaped [B,S] or [B,S,1].
Sourcepub fn forward_conditioned(
&self,
tokens: &Matrix,
condition: &Matrix,
token_mask: Option<&Matrix>,
) -> Result<Matrix>
pub fn forward_conditioned( &self, tokens: &Matrix, condition: &Matrix, token_mask: Option<&Matrix>, ) -> Result<Matrix>
Apply adaptive conditioning with an optional binary key mask.
Sourcepub fn set_sequence_length(&self, sequence_length: usize) -> Result<()>
pub fn set_sequence_length(&self, sequence_length: usize) -> Result<()>
Update sequence geometry without rebuilding parameters.
pub fn config(&self) -> FlowTransformerConfig
pub fn is_moe(&self) -> bool
pub fn num_layers(&self) -> usize
pub fn block(&self, index: usize) -> Option<&TransformerBlock>
Trait Implementations§
Source§impl Module for FlowTransformer
impl Module for FlowTransformer
Source§fn forward(&self, input: &Matrix) -> Result<Matrix>
fn forward(&self, input: &Matrix) -> Result<Matrix>
Evaluate one Matrix input without submitting or waiting.
Source§fn registry(&self) -> &ModuleRegistry
fn registry(&self) -> &ModuleRegistry
Return this module’s structural registry.
Source§fn parameters(&self) -> Vec<Parameter>
fn parameters(&self) -> Vec<Parameter>
Return direct parameters only.
Source§fn named_parameters(&self) -> Vec<NamedParameter>
fn named_parameters(&self) -> Vec<NamedParameter>
Return direct parameters with local registration names.
Source§fn named_buffers(&self) -> Vec<NamedBuffer>
fn named_buffers(&self) -> Vec<NamedBuffer>
Return direct buffers with local registration names and persistence flags.
Source§fn all_parameters(&self) -> Result<Vec<Parameter>>
fn all_parameters(&self) -> Result<Vec<Parameter>>
Return every parameter exactly once in deterministic depth-first order. Read more
Source§fn all_named_parameters(&self) -> Result<Vec<NamedParameter>>
fn all_named_parameters(&self) -> Result<Vec<NamedParameter>>
Return every parameter with its registration-derived dotted path. Read more
Source§fn all_named_buffers(&self) -> Result<Vec<NamedBuffer>>
fn all_named_buffers(&self) -> Result<Vec<NamedBuffer>>
Return all direct and recursive buffers in deterministic depth-first order. Read more
Source§fn all_named_state_u32(&self) -> Result<Vec<NamedStateU32>>
fn all_named_state_u32(&self) -> Result<Vec<NamedStateU32>>
Return all direct and recursive persistent
u32 scalar state in
deterministic depth-first order. Read moreSource§fn all_named_rng_states(&self) -> Result<Vec<NamedRngState>>
fn all_named_rng_states(&self) -> Result<Vec<NamedRngState>>
Return all direct and recursive stochastic RNG streams in deterministic
depth-first order. Read more
Source§fn num_parameters(&self) -> Result<usize>
fn num_parameters(&self) -> Result<usize>
Return the total number of trainable scalar values. Read more
Source§fn is_training(&self) -> bool
fn is_training(&self) -> bool
Return this module’s current train/eval mode.
Source§fn scoped_eval(&self) -> ScopedEval<'_>
fn scoped_eval(&self) -> ScopedEval<'_>
Enter evaluation mode until the returned guard is dropped.
Auto Trait Implementations§
impl !Freeze for FlowTransformer
impl !RefUnwindSafe for FlowTransformer
impl !Send for FlowTransformer
impl !Sync for FlowTransformer
impl !UnwindSafe for FlowTransformer
impl Forget for FlowTransformer
impl Move for FlowTransformer
impl Unpin for FlowTransformer
impl UnsafeUnpin for FlowTransformerwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<Rc<TransformerBlock>>: UnsafeUnpin,
*const RcInner<LayerNorm> is !null: UnsafeUnpin,
PhantomData<RcInner<LayerNorm>>: UnsafeUnpin,
PhantomData<ParameterEntry>: UnsafeUnpin,
PhantomData<BufferEntry>: UnsafeUnpin,
PhantomData<StateU32Entry>: UnsafeUnpin,
PhantomData<RngStateEntry>: UnsafeUnpin,
PhantomData<ChildEntry>: UnsafeUnpin,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more