pub struct FeatureFusion<F: Float + Debug + ScalarOperand + Send + Sync> {
pub aligners: Vec<FeatureAlignment<F>>,
pub fusion_module: Option<Box<dyn Layer<F> + Send + Sync>>,
pub post_fusion: Sequential<F>,
pub classifier: Option<Dense<F>>,
pub config: FeatureFusionConfig,
}
Expand description
Feature Fusion model
Fields§
§aligners: Vec<FeatureAlignment<F>>
Feature aligners for each input modality
fusion_module: Option<Box<dyn Layer<F> + Send + Sync>>
Fusion-specific modules
post_fusion: Sequential<F>
Post-fusion MLP
classifier: Option<Dense<F>>
Classifier head
config: FeatureFusionConfig
Model configuration
Implementations§
Source§impl<F: Float + Debug + ScalarOperand + Send + Sync> FeatureFusion<F>
impl<F: Float + Debug + ScalarOperand + Send + Sync> FeatureFusion<F>
Sourcepub fn new(config: FeatureFusionConfig) -> Result<Self>
pub fn new(config: FeatureFusionConfig) -> Result<Self>
Create a new FeatureFusion model
Sourcepub fn forward_multi(
&self,
inputs: &[Array<F, IxDyn>],
) -> Result<Array<F, IxDyn>>
pub fn forward_multi( &self, inputs: &[Array<F, IxDyn>], ) -> Result<Array<F, IxDyn>>
Forward pass with multiple input modalities
Sourcepub fn create_early_fusion(
dim_a: usize,
dim_b: usize,
hidden_dim: usize,
num_classes: usize,
include_head: bool,
) -> Result<Self>
pub fn create_early_fusion( dim_a: usize, dim_b: usize, hidden_dim: usize, num_classes: usize, include_head: bool, ) -> Result<Self>
Create a simple early fusion model for two modalities
Trait Implementations§
Source§impl<F: Float + Debug + ScalarOperand + Send + Sync> Clone for FeatureFusion<F>
impl<F: Float + Debug + ScalarOperand + Send + Sync> Clone for FeatureFusion<F>
Source§impl<F: Float + Debug + ScalarOperand + Send + Sync> Debug for FeatureFusion<F>
impl<F: Float + Debug + ScalarOperand + Send + Sync> Debug for FeatureFusion<F>
Source§impl<F: Float + Debug + ScalarOperand + Send + Sync> Layer<F> for FeatureFusion<F>
impl<F: Float + Debug + ScalarOperand + Send + Sync> Layer<F> for FeatureFusion<F>
Source§fn forward(&self, _input: &Array<F, IxDyn>) -> Result<Array<F, IxDyn>>
fn forward(&self, _input: &Array<F, IxDyn>) -> Result<Array<F, IxDyn>>
Forward pass of the layer Read more
Source§fn backward(
&self,
_input: &Array<F, IxDyn>,
_grad_output: &Array<F, IxDyn>,
) -> Result<Array<F, IxDyn>>
fn backward( &self, _input: &Array<F, IxDyn>, _grad_output: &Array<F, IxDyn>, ) -> Result<Array<F, IxDyn>>
Backward pass of the layer to compute gradients Read more
Source§fn update(&mut self, _learning_rate: F) -> Result<()>
fn update(&mut self, _learning_rate: F) -> Result<()>
Update the layer parameters with the given gradients Read more
Source§fn set_training(&mut self, training: bool)
fn set_training(&mut self, training: bool)
Set the layer to training mode (true) or evaluation mode (false) Read more
Source§fn is_training(&self) -> bool
fn is_training(&self) -> bool
Get the current training mode Read more
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Get the layer as a mutable dyn Any for downcasting Read more
Source§fn gradients(&self) -> Vec<Array<F, IxDyn>> ⓘ
fn gradients(&self) -> Vec<Array<F, IxDyn>> ⓘ
Get the gradients of the layer parameters Read more
Source§fn set_gradients(&mut self, _gradients: &[Array<F, IxDyn>]) -> Result<()>
fn set_gradients(&mut self, _gradients: &[Array<F, IxDyn>]) -> Result<()>
Set the gradients of the layer parameters Read more
Source§fn set_params(&mut self, _params: &[Array<F, IxDyn>]) -> Result<()>
fn set_params(&mut self, _params: &[Array<F, IxDyn>]) -> Result<()>
Set the parameters of the layer Read more
Source§fn layer_type(&self) -> &str
fn layer_type(&self) -> &str
Get the type of the layer (e.g., “Dense”, “Conv2D”) Read more
Source§fn parameter_count(&self) -> usize
fn parameter_count(&self) -> usize
Get the number of trainable parameters in this layer Read more
Source§fn layer_description(&self) -> String
fn layer_description(&self) -> String
Get a detailed description of this layer Read more
Auto Trait Implementations§
impl<F> !Freeze for FeatureFusion<F>
impl<F> !RefUnwindSafe for FeatureFusion<F>
impl<F> Send for FeatureFusion<F>
impl<F> Sync for FeatureFusion<F>
impl<F> Unpin for FeatureFusion<F>where
F: Unpin,
impl<F> !UnwindSafe for FeatureFusion<F>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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