pub struct MultiTaskNetwork<T: FloatBounds> { /* private fields */ }Expand description
Multi-task neural network model
Implementations§
Source§impl<T: FloatBounds + ScalarOperand + Sum> MultiTaskNetwork<T>
impl<T: FloatBounds + ScalarOperand + Sum> MultiTaskNetwork<T>
Sourcepub fn new(config: MultiTaskConfig<T>) -> Self
pub fn new(config: MultiTaskConfig<T>) -> Self
Create a new multi-task network
Sourcepub fn build_architecture(&mut self) -> NeuralResult<()>
pub fn build_architecture(&mut self) -> NeuralResult<()>
Build the network architecture based on configuration
Sourcepub fn forward_task(
&mut self,
input: &Array2<T>,
task_name: &str,
training: bool,
) -> NeuralResult<Array2<T>>
pub fn forward_task( &mut self, input: &Array2<T>, task_name: &str, training: bool, ) -> NeuralResult<Array2<T>>
Forward pass for a specific task
Sourcepub fn forward_all_tasks(
&mut self,
input: &Array2<T>,
training: bool,
) -> NeuralResult<HashMap<String, Array2<T>>>
pub fn forward_all_tasks( &mut self, input: &Array2<T>, training: bool, ) -> NeuralResult<HashMap<String, Array2<T>>>
Forward pass for all tasks
Sourcepub fn compute_multi_task_loss(
&self,
predictions: &HashMap<String, Array2<T>>,
targets: &HashMap<String, Array2<T>>,
) -> NeuralResult<T>
pub fn compute_multi_task_loss( &self, predictions: &HashMap<String, Array2<T>>, targets: &HashMap<String, Array2<T>>, ) -> NeuralResult<T>
Compute multi-task loss
Sourcepub fn update_task_weights(
&mut self,
task_losses: &[T],
_epoch: usize,
) -> NeuralResult<()>
pub fn update_task_weights( &mut self, task_losses: &[T], _epoch: usize, ) -> NeuralResult<()>
Update task weights based on strategy
Sourcepub fn config(&self) -> &MultiTaskConfig<T>
pub fn config(&self) -> &MultiTaskConfig<T>
Get configuration
Sourcepub fn task_names(&self) -> &[String]
pub fn task_names(&self) -> &[String]
Get task names
Sourcepub fn set_fitted(&mut self, fitted: bool)
pub fn set_fitted(&mut self, fitted: bool)
Set fitted state
Sourcepub fn task_weights(&self) -> &[T]
pub fn task_weights(&self) -> &[T]
Get current task weights
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for MultiTaskNetwork<T>
impl<T> !Send for MultiTaskNetwork<T>
impl<T> !Sync for MultiTaskNetwork<T>
impl<T> !UnwindSafe for MultiTaskNetwork<T>
impl<T> Freeze for MultiTaskNetwork<T>where
T: Freeze,
impl<T> Unpin for MultiTaskNetwork<T>where
T: Unpin,
impl<T> UnsafeUnpin for MultiTaskNetwork<T>where
T: 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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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