pub struct FlowTimeEmbedding { /* private fields */ }Expand description
GPU sinusoidal embedding for normalized continuous flow time.
Implementations§
Source§impl FlowTimeEmbedding
impl FlowTimeEmbedding
pub fn new( embedding_dim: usize, max_period: f32, time_scale: f32, ) -> Result<Self>
Sourcepub fn new_on(
runtime: &Runtime,
embedding_dim: usize,
max_period: f32,
time_scale: f32,
) -> Result<Self>
pub fn new_on( runtime: &Runtime, embedding_dim: usize, max_period: f32, time_scale: f32, ) -> Result<Self>
Construct the donor sinusoidal time embedding.
§Errors
Returns an error unless embedding_dim is positive and even,
max_period is finite and greater than one, and time_scale is finite
and positive.
Sourcepub fn forward(&self, time: &Matrix) -> Result<Matrix>
pub fn forward(&self, time: &Matrix) -> Result<Matrix>
Embed F32 time values shaped [B] or [B, 1] as [B, D].
§Errors
Returns an error for any other shape or dtype, another runtime, or a failed Matrix operation.
Sourcepub const fn embedding_dim(&self) -> usize
pub const fn embedding_dim(&self) -> usize
Return the output embedding width.
Sourcepub const fn max_period(&self) -> f32
pub const fn max_period(&self) -> f32
Return the maximum sinusoidal period.
Sourcepub const fn time_scale(&self) -> f32
pub const fn time_scale(&self) -> f32
Return the multiplicative input-time scale.
Trait Implementations§
Source§impl Module for FlowTimeEmbedding
impl Module for FlowTimeEmbedding
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 FlowTimeEmbedding
impl !RefUnwindSafe for FlowTimeEmbedding
impl !Send for FlowTimeEmbedding
impl !Sync for FlowTimeEmbedding
impl !UnwindSafe for FlowTimeEmbedding
impl Forget for FlowTimeEmbedding
impl Move for FlowTimeEmbedding
impl Unpin for FlowTimeEmbedding
impl UnsafeUnpin for FlowTimeEmbeddingwhere
*const RcInner<RefCell<RuntimeState>> is !null: UnsafeUnpin,
PhantomData<RcInner<RefCell<RuntimeState>>>: UnsafeUnpin,
*const RcInner<StorageInner> is !null: UnsafeUnpin,
PhantomData<RcInner<StorageInner>>: UnsafeUnpin,
*const u8 is !null: UnsafeUnpin,
PhantomData<usize>: UnsafeUnpin,
*const RcInner<MatrixSemantic> is !null: UnsafeUnpin,
PhantomData<RcInner<MatrixSemantic>>: UnsafeUnpin,
PhantomData<Rc<()>>: 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