pub enum CfcMode {
Default = 0,
Pure = 1,
NoGate = 2,
}Expand description
Operating modes for CfC cells.
Each mode implements a different approach to computing the hidden state update. The choice affects both computational cost and model behavior.
§Mode Comparison
| Mode | Formula | Best For |
|---|---|---|
Default | h = tanh(ff1) × (1-σ) + tanh(ff2) × σ | Most tasks (recommended) |
Pure | h = a - a × exp(-t × |w_τ| + |ff1|) × ff1 | Biological accuracy |
NoGate | h = tanh(ff1) + tanh(ff2) × σ | Simple dynamics |
§Choosing a Mode
§Default (Recommended)
The gated interpolation mode provides the best balance of:
- Expressive power (two separate paths)
- Training stability (sigmoid gating)
- Flexibility (learns when to use each path)
Use this unless you have a specific reason not to.
§Pure
The ODE-based mode is closer to the original LTC formulation:
- More biologically plausible
- Direct continuous-time dynamics
- Can be less stable during training
- Fewer parameters (no ff2, time_a, time_b)
Use when biological accuracy matters or for comparison studies.
§NoGate
The additive mode simplifies the gating mechanism:
- Adds instead of interpolates
- Can be easier to train on simple tasks
- May underfit on complex tasks
Use for simple sequential patterns or ablation studies.
Variants§
Default = 0
Recommended. Gated interpolation between two feedforward paths.
Formula: h = tanh(ff1) × (1 - σ(t)) + tanh(ff2) × σ(t)
The time-dependent sigmoid σ(t) = sigmoid(time_a × t + time_b) controls
how much each path contributes to the output.
Pure = 1
Pure ODE solution without gating. More biologically plausible.
Formula: h = a - a × exp(-t × (|w_τ| + |ff1|)) × ff1
Uses learned time constants w_τ and amplitude a.
Has fewer parameters than Default mode.
NoGate = 2
Simplified additive mode (no interpolation).
Formula: h = tanh(ff1) + tanh(ff2) × σ(t)
Adds the gated component instead of interpolating. Can work well for simpler tasks.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for CfcMode
impl<'de> Deserialize<'de> for CfcMode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Copy for CfcMode
impl Eq for CfcMode
impl StructuralPartialEq for CfcMode
Auto Trait Implementations§
impl Freeze for CfcMode
impl RefUnwindSafe for CfcMode
impl Send for CfcMode
impl Sync for CfcMode
impl Unpin for CfcMode
impl UnwindSafe for CfcMode
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more