pub struct Wrapped<W: Wrappable> { /* private fields */ }Expand description
wraps in a burn wrapper
Implementations§
Source§impl<A: AutodiffBackend<InnerBackend = B>, B: Backend, W, Y: 'static + ItemLazy + Send + Sync, Z: 'static + ItemLazy + Send + Sync> Wrapped<W>where
<Self as AutodiffModule<A>>::InnerModule: ValidStep<(Value<B>, Value<B>), Z>,
Self: TrainStep<(Value<A>, Value<A>), Y>,
W::Decomposition: AutodiffModule<A>,
W::With<B>: Decompose<Decomposition = <W::Decomposition as AutodiffModule<A>>::InnerModule> + Op<Output = Z>,
W: Op<Output = Y> + 'static + Wrappable<B = A>,
Y::ItemSync: Adaptor<LossInput<NdArray>>,
Z::ItemSync: Adaptor<LossInput<NdArray>>,
impl<A: AutodiffBackend<InnerBackend = B>, B: Backend, W, Y: 'static + ItemLazy + Send + Sync, Z: 'static + ItemLazy + Send + Sync> Wrapped<W>where
<Self as AutodiffModule<A>>::InnerModule: ValidStep<(Value<B>, Value<B>), Z>,
Self: TrainStep<(Value<A>, Value<A>), Y>,
W::Decomposition: AutodiffModule<A>,
W::With<B>: Decompose<Decomposition = <W::Decomposition as AutodiffModule<A>>::InnerModule> + Op<Output = Z>,
W: Op<Output = Y> + 'static + Wrappable<B = A>,
Y::ItemSync: Adaptor<LossInput<NdArray>>,
Z::ItemSync: Adaptor<LossInput<NdArray>>,
Sourcepub fn train<I: 'static + Clone + Debug + Into<(Value<A>, Value<A>)> + Send + Sync, J: 'static + Clone + Debug + Into<(Value<B>, Value<B>)> + Send + Sync, O: 'static + Optimizer<Self, A>, S: 'static + LrScheduler, T: 'static + Dataset<I>, V: 'static + Dataset<J>>(
self,
config: &TrainConfig,
optimizer: O,
scheduler: S,
train: T,
valid: V,
) -> Wrapped<W::With<B>>
pub fn train<I: 'static + Clone + Debug + Into<(Value<A>, Value<A>)> + Send + Sync, J: 'static + Clone + Debug + Into<(Value<B>, Value<B>)> + Send + Sync, O: 'static + Optimizer<Self, A>, S: 'static + LrScheduler, T: 'static + Dataset<I>, V: 'static + Dataset<J>>( self, config: &TrainConfig, optimizer: O, scheduler: S, train: T, valid: V, ) -> Wrapped<W::With<B>>
trains the model
Trait Implementations§
Source§impl<A: AutodiffBackend, W: Wrappable<B = A>> AutodiffModule<A> for Wrapped<W>where
W::Decomposition: AutodiffModule<A>,
W::With<A::InnerBackend>: Decompose<Decomposition = <W::Decomposition as AutodiffModule<A>>::InnerModule>,
impl<A: AutodiffBackend, W: Wrappable<B = A>> AutodiffModule<A> for Wrapped<W>where
W::Decomposition: AutodiffModule<A>,
W::With<A::InnerBackend>: Decompose<Decomposition = <W::Decomposition as AutodiffModule<A>>::InnerModule>,
Source§type InnerModule = Wrapped<<W as Wrappable>::With<<A as AutodiffBackend>::InnerBackend>>
type InnerModule = Wrapped<<W as Wrappable>::With<<A as AutodiffBackend>::InnerBackend>>
Inner module without auto-differentiation.
Source§fn valid(&self) -> Self::InnerModule
fn valid(&self) -> Self::InnerModule
Get the same module, but on the inner backend without auto-differentiation.
Source§impl<W: Wrappable> Decompose for Wrapped<W>
impl<W: Wrappable> Decompose for Wrapped<W>
Source§type Decomposition = <W as Decompose>::Decomposition
type Decomposition = <W as Decompose>::Decomposition
the decomposed type
Source§fn compose(decomposition: Self::Decomposition) -> Self
fn compose(decomposition: Self::Decomposition) -> Self
recreates from the decomposition
Source§fn decompose(self) -> Self::Decomposition
fn decompose(self) -> Self::Decomposition
owned decomposition
Source§fn decompose_cloned(&self) -> Self::Decomposition
fn decompose_cloned(&self) -> Self::Decomposition
decomposition that copies data
Source§impl<B: Backend, W: Wrappable<B = B>> Module<B> for Wrapped<W>where
W::Decomposition: Module<B>,
impl<B: Backend, W: Wrappable<B = B>> Module<B> for Wrapped<W>where
W::Decomposition: Module<B>,
Source§type Record = <<W as Decompose>::Decomposition as Module<B>>::Record
type Record = <<W as Decompose>::Decomposition as Module<B>>::Record
Type to save and load the module.
Source§fn collect_devices(
&self,
devices: Vec<<B as Backend>::Device>,
) -> Vec<<B as Backend>::Device>
fn collect_devices( &self, devices: Vec<<B as Backend>::Device>, ) -> Vec<<B as Backend>::Device>
Return all the devices found in the underneath module tree added to the given vector
without duplicates.
Source§fn devices(&self) -> Vec<<B as Backend>::Device>
fn devices(&self) -> Vec<<B as Backend>::Device>
Return all the devices found in the underneath module tree without duplicates.
Source§fn fork(self, device: &<B as Backend>::Device) -> Self
fn fork(self, device: &<B as Backend>::Device) -> Self
Fork the module and all of its sub-modules to the given device. Read more
Source§fn into_record(self) -> Self::Record
fn into_record(self) -> Self::Record
Convert the module into a record containing the state.
Source§fn load_file<F: FileRecorder<B>, P: Into<PathBuf>>(
self,
filepath: P,
recorder: &F,
device: &<B as Backend>::Device,
) -> Result<Self, RecorderError>
fn load_file<F: FileRecorder<B>, P: Into<PathBuf>>( self, filepath: P, recorder: &F, device: &<B as Backend>::Device, ) -> Result<Self, RecorderError>
Load the module from a file using the provided file recorder. Read more
Source§fn load_record(self, record: Self::Record) -> Self
fn load_record(self, record: Self::Record) -> Self
Load the module state from a record.
Source§fn map<Mapper: ModuleMapper<B>>(self, mapper: &mut Mapper) -> Self
fn map<Mapper: ModuleMapper<B>>(self, mapper: &mut Mapper) -> Self
Map each tensor parameter in the module with a mapper.
Source§fn num_params(&self) -> usize
fn num_params(&self) -> usize
Get the number of parameters the module has, including all of its sub-modules.
Source§fn quantize_weights(self, quantizer: &mut Quantizer) -> Self
fn quantize_weights(self, quantizer: &mut Quantizer) -> Self
Quantize the weights of the module.
Source§fn save_file<F: FileRecorder<B>, P: Into<PathBuf>>(
self,
filepath: P,
recorder: &F,
) -> Result<(), RecorderError>
fn save_file<F: FileRecorder<B>, P: Into<PathBuf>>( self, filepath: P, recorder: &F, ) -> Result<(), RecorderError>
Save the module to a file using the provided file recorder. Read more
Source§fn to_device(self, device: &<B as Backend>::Device) -> Self
fn to_device(self, device: &<B as Backend>::Device) -> Self
Move the module and all of its sub-modules to the given device. Read more
Source§fn visit<Visitor: ModuleVisitor<B>>(&self, visitor: &mut Visitor)
fn visit<Visitor: ModuleVisitor<B>>(&self, visitor: &mut Visitor)
Visit each tensor parameter in the module with a visitor.
Source§impl<W: Wrappable> ModuleDisplay for Wrapped<W>where
W::Decomposition: ModuleDisplay,
impl<W: Wrappable> ModuleDisplay for Wrapped<W>where
W::Decomposition: ModuleDisplay,
Source§fn custom_content(&self, content: Content) -> Option<Content>
fn custom_content(&self, content: Content) -> Option<Content>
Custom attributes for the module. Read more
Source§fn custom_settings(&self) -> Option<DisplaySettings>
fn custom_settings(&self) -> Option<DisplaySettings>
Custom display settings for the module. Read more
Source§impl<W: Wrappable> ModuleDisplayDefault for Wrapped<W>where
W::Decomposition: ModuleDisplayDefault,
impl<W: Wrappable> ModuleDisplayDefault for Wrapped<W>where
W::Decomposition: ModuleDisplayDefault,
Source§impl<W: Op + Wrappable> Op for Wrapped<W>
impl<W: Op + Wrappable> Op for Wrapped<W>
Source§type Output = <W as Op>::Output
type Output = <W as Op>::Output
suggested output type to help with composition coherence. Ideally, Self should implement AI<X,Self::Output> for some X
Source§fn abnormal_softmax(self, temperature: f32) -> AbnormalSoftmax<Self>
fn abnormal_softmax(self, temperature: f32) -> AbnormalSoftmax<Self>
wraps with a softmax operation
Source§fn chain<B>(self, b: B) -> Sequential<(Self, B)>
fn chain<B>(self, b: B) -> Sequential<(Self, B)>
sequences with another ai operation
Source§fn cross_entropy(self, temperature: f32) -> CrossEntropy<Self>
fn cross_entropy(self, temperature: f32) -> CrossEntropy<Self>
wraps with a cross entropy operation. If temperature is a number it will be used to apply softmax to the logits before computing entropy with the target. if the input will already be a probability distribution instead of logits, put NaN temperature
Source§fn forward_fixed<Z>(&self, input: Z) -> Z
fn forward_fixed<Z>(&self, input: Z) -> Z
applies to the input
Source§fn forward_fixed_mut<Z>(&mut self, input: Z) -> Z
fn forward_fixed_mut<Z>(&mut self, input: Z) -> Z
applies to the input
Source§fn forward_typed<W, Z>(&self, input: W) -> Z
fn forward_typed<W, Z>(&self, input: W) -> Z
applies to the input
Source§fn forward_typed_mut<W, Z>(&mut self, input: W) -> Z
fn forward_typed_mut<W, Z>(&mut self, input: W) -> Z
applies to the input, possibly updating internal caches
Source§fn infer_autoregressive<X, Y>(self, input: X) -> Autoregression<Self, Y> ⓘ
fn infer_autoregressive<X, Y>(self, input: X) -> Autoregression<Self, Y> ⓘ
creates an autoregressive inference
Source§fn log_softmax(self, temperature: f32) -> LogSoftmax<Self>
fn log_softmax(self, temperature: f32) -> LogSoftmax<Self>
wraps with a softmax operation
Source§fn map<B>(self, b: B) -> Map<Sequential<(Self, B)>>
fn map<B>(self, b: B) -> Map<Sequential<(Self, B)>>
applies the operation to every output
Source§fn soft_choose(self, temperature: f32) -> Choose<Self>
fn soft_choose(self, temperature: f32) -> Choose<Self>
wraps with a choose operation
Source§fn squared_error(self) -> SquaredError<Self>
fn squared_error(self) -> SquaredError<Self>
wraps with a mse operation
Source§fn wrap_inner(self) -> Inner<Self>where
Self: Sized,
fn wrap_inner(self) -> Inner<Self>where
Self: Sized,
wraps the inner value so it can be unwrapped with unwrap inner
Source§impl<C: Backend, W: ToBackend<C, OnBackend = W::With<C>> + Wrappable> ToBackend<C> for Wrapped<W>
impl<C: Backend, W: ToBackend<C, OnBackend = W::With<C>> + Wrappable> ToBackend<C> for Wrapped<W>
Source§impl<A: AutodiffBackend, W: AI<X, LossOutput<A>> + Wrappable<B = A>, X> TrainStep<X, ClassificationOutput<A>> for Wrapped<Classification<W>>where
W::Decomposition: AutodiffModule<A>,
W::With<A::InnerBackend>: Decompose<Decomposition = <W::Decomposition as AutodiffModule<A>>::InnerModule>,
impl<A: AutodiffBackend, W: AI<X, LossOutput<A>> + Wrappable<B = A>, X> TrainStep<X, ClassificationOutput<A>> for Wrapped<Classification<W>>where
W::Decomposition: AutodiffModule<A>,
W::With<A::InnerBackend>: Decompose<Decomposition = <W::Decomposition as AutodiffModule<A>>::InnerModule>,
Source§fn step(&self, item: X) -> TrainOutput<ClassificationOutput<A>>
fn step(&self, item: X) -> TrainOutput<ClassificationOutput<A>>
Runs the training step, which executes the forward and backward passes. Read more
Source§impl<A: AutodiffBackend, W: AI<X, LossOutput<A>> + Wrappable<B = A>, X> TrainStep<X, RegressionOutput<A>> for Wrapped<Regression<W>>where
W::Decomposition: AutodiffModule<A>,
W::With<A::InnerBackend>: Decompose<Decomposition = <W::Decomposition as AutodiffModule<A>>::InnerModule>,
impl<A: AutodiffBackend, W: AI<X, LossOutput<A>> + Wrappable<B = A>, X> TrainStep<X, RegressionOutput<A>> for Wrapped<Regression<W>>where
W::Decomposition: AutodiffModule<A>,
W::With<A::InnerBackend>: Decompose<Decomposition = <W::Decomposition as AutodiffModule<A>>::InnerModule>,
Source§fn step(&self, item: X) -> TrainOutput<RegressionOutput<A>>
fn step(&self, item: X) -> TrainOutput<RegressionOutput<A>>
Runs the training step, which executes the forward and backward passes. Read more
Source§impl<W: UnwrapInner + Wrappable> UnwrapInner for Wrapped<W>
impl<W: UnwrapInner + Wrappable> UnwrapInner for Wrapped<W>
Source§type Inner = <W as UnwrapInner>::Inner
type Inner = <W as UnwrapInner>::Inner
the inner type
Source§fn unwrap_inner(self) -> Self::Inner
fn unwrap_inner(self) -> Self::Inner
unwraps the inner value
Source§impl<B: Backend, W: AI<X, LossOutput<B>> + Wrappable<B = B>, X> ValidStep<X, ClassificationOutput<B>> for Wrapped<Classification<W>>where
W::Decomposition: Module<B>,
impl<B: Backend, W: AI<X, LossOutput<B>> + Wrappable<B = B>, X> ValidStep<X, ClassificationOutput<B>> for Wrapped<Classification<W>>where
W::Decomposition: Module<B>,
Source§fn step(&self, item: X) -> ClassificationOutput<B>
fn step(&self, item: X) -> ClassificationOutput<B>
Runs a validation step. Read more
Source§impl<B: Backend, W: AI<X, LossOutput<B>> + Wrappable<B = B>, X> ValidStep<X, RegressionOutput<B>> for Wrapped<Regression<W>>where
W::Decomposition: Module<B>,
impl<B: Backend, W: AI<X, LossOutput<B>> + Wrappable<B = B>, X> ValidStep<X, RegressionOutput<B>> for Wrapped<Regression<W>>where
W::Decomposition: Module<B>,
Source§fn step(&self, item: X) -> RegressionOutput<B>
fn step(&self, item: X) -> RegressionOutput<B>
Runs a validation step. Read more
impl<W: Copy + Wrappable> Copy for Wrapped<W>
Auto Trait Implementations§
impl<W> Freeze for Wrapped<W>where
W: Freeze,
impl<W> RefUnwindSafe for Wrapped<W>where
W: RefUnwindSafe,
impl<W> Send for Wrapped<W>
impl<W> Sync for Wrapped<W>where
W: Sync,
impl<W> Unpin for Wrapped<W>where
W: Unpin,
impl<W> UnwindSafe for Wrapped<W>where
W: UnwindSafe,
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Shortcuts for T
impl<T> Shortcuts for T
Source§fn classification(self) -> Classification<Self>
fn classification(self) -> Classification<Self>
wraps in a classification wrapper
Source§fn regression(self) -> Regression<Self>
fn regression(self) -> Regression<Self>
wraps in a regression wrapper
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read more