Struct juice::solver::Solver

source ·
pub struct Solver<SolverB, B>
where SolverB: IBackend + SolverOps<f32>, B: IBackend + LayerOps<f32>,
{ 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>
where SolverB: IBackend + SolverOps<f32> + 'static, B: IBackend + LayerOps<f32> + 'static,

source

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>
where SolverB: IBackend + SolverOps<f32> + 'static, B: IBackend + LayerOps<f32> + 'static,

source

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

source

pub fn network(&self) -> &Layer<B>

Returns the network trained by the solver.

This is the recommended method to get a usable trained network.

source

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§

source§

impl<SolverB, B> Debug for Solver<SolverB, B>
where SolverB: IBackend + SolverOps<f32> + Debug, B: IBackend + LayerOps<f32> + Debug,

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V