pub struct Solver<SolverB, B>{
pub worker: Box<dyn ISolver<SolverB, B>>,
/* private fields */
}
Expand description
Solver that optimizes a [Layer][1] with a given objective. [1]: ../layer/index.html
Fields§
§worker: Box<dyn ISolver<SolverB, B>>
The implementation of the Solver
Implementations§
source§impl<SolverB, B> Solver<SolverB, B>
impl<SolverB, B> Solver<SolverB, B>
sourcepub fn from_config(
net_backend: Rc<B>,
obj_backend: Rc<SolverB>,
config: &SolverConfig
) -> Solver<SolverB, B>
pub fn from_config( net_backend: Rc<B>, obj_backend: Rc<SolverB>, config: &SolverConfig ) -> Solver<SolverB, B>
Create Solver from [SolverConfig][1] [1]: ./struct.SolverConfig.html
This is the preferred method to create a Solver for training a neural network.
source§impl<SolverB, B> Solver<SolverB, B>
impl<SolverB, B> Solver<SolverB, B>
sourcepub fn train_minibatch(
&mut self,
mb_data: ArcLock<SharedTensor<f32>>,
mb_target: ArcLock<SharedTensor<f32>>
) -> ArcLock<SharedTensor<f32>>
pub fn train_minibatch( &mut self, mb_data: ArcLock<SharedTensor<f32>>, mb_target: ArcLock<SharedTensor<f32>> ) -> ArcLock<SharedTensor<f32>>
Train the network with one minibatch
sourcepub fn network(&self) -> &Layer<B>
pub fn network(&self) -> &Layer<B>
Returns the network trained by the solver.
This is the recommended method to get a usable trained network.
sourcepub fn mut_network(&mut self) -> &mut Layer<B>
pub fn mut_network(&mut self) -> &mut Layer<B>
Returns the network trained by the solver.
This is the recommended method to get a trained network, if you want to alter the network. Keep in mind that altering the network might render the solver unusable and continuing training the network with it will yield unexpected results.
Trait Implementations§
Auto Trait Implementations§
impl<SolverB, B> !RefUnwindSafe for Solver<SolverB, B>
impl<SolverB, B> !Send for Solver<SolverB, B>
impl<SolverB, B> !Sync for Solver<SolverB, B>
impl<SolverB, B> Unpin for Solver<SolverB, B>where
SolverB: Unpin,
impl<SolverB, B> !UnwindSafe for Solver<SolverB, B>
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