pub struct Sequential { /* private fields */ }Expand description
Sequential container
Implementations§
Source§impl Sequential
impl Sequential
Trait Implementations§
Source§impl Debug for Sequential
impl Debug for Sequential
Source§impl Default for Sequential
impl Default for Sequential
Source§impl Module for Sequential
impl Module for Sequential
Source§fn buffers(&self) -> Vec<Arc<RwLock<Tensor>>>
fn buffers(&self) -> Vec<Arc<RwLock<Tensor>>>
Every child’s buffers, in child order.
Without this override the container answered the trait default
(Vec::new()), so a Sequential holding a BatchNorm reported zero
buffers and its state_dict() silently dropped every running statistic
— a saved model reloaded with freshly initialized statistics and
evaluated differently, with no error anywhere. See
tests/hardening_nn_state_dict.rs.
Source§fn named_buffers(&self) -> HashMap<String, Arc<RwLock<Tensor>>>
fn named_buffers(&self) -> HashMap<String, Arc<RwLock<Tensor>>>
The same buffers as Self::buffers, keyed "{index}.{name}" — the
key scheme Self::named_parameters already uses, so the parameter and
buffer halves of a checkpoint agree on how to address a child.
Source§fn named_children(&self) -> Vec<(String, &dyn Module)>
fn named_children(&self) -> Vec<(String, &dyn Module)>
The same children as Self::children, addressed by their index.
Every name-carrying recursion in the trait
(all_named_parameters, all_named_buffers, named_modules) walks
named_children(), not children(). Overriding only the latter left
the container invisible to all three.
Source§fn parameters(&self) -> HashMap<String, Parameter>
fn parameters(&self) -> HashMap<String, Parameter>
Source§fn named_parameters(&self) -> HashMap<String, Parameter>
fn named_parameters(&self) -> HashMap<String, Parameter>
Source§fn set_training(&mut self, training: bool)
fn set_training(&mut self, training: bool)
Source§fn all_parameters(&self) -> HashMap<String, Parameter>
fn all_parameters(&self) -> HashMap<String, Parameter>
Source§fn all_named_parameters(&self) -> HashMap<String, Parameter>
fn all_named_parameters(&self) -> HashMap<String, Parameter>
Source§fn all_named_buffers(&self) -> HashMap<String, Arc<RwLock<Tensor>>>
fn all_named_buffers(&self) -> HashMap<String, Arc<RwLock<Tensor>>>
Source§fn load_state_dict(
&mut self,
state_dict: &HashMap<String, Tensor>,
strict: bool,
) -> Result<()>
fn load_state_dict( &mut self, state_dict: &HashMap<String, Tensor>, strict: bool, ) -> Result<()>
Source§fn load_state_dict_strict(
&mut self,
state_dict: &HashMap<String, Tensor>,
) -> Result<()>
fn load_state_dict_strict( &mut self, state_dict: &HashMap<String, Tensor>, ) -> Result<()>
Source§fn state_dict(&self) -> HashMap<String, Tensor>
fn state_dict(&self) -> HashMap<String, Tensor>
Source§fn name(&self) -> Option<&str>
fn name(&self) -> Option<&str>
Source§fn modules(&self) -> Vec<&dyn Module>where
Self: Sized,
fn modules(&self) -> Vec<&dyn Module>where
Self: Sized,
Source§fn named_modules(&self) -> Vec<(String, &dyn Module)>where
Self: Sized,
fn named_modules(&self) -> Vec<(String, &dyn Module)>where
Self: Sized,
Source§fn num_parameters(&self) -> usize
fn num_parameters(&self) -> usize
Source§fn num_trainable_parameters(&self) -> usize
fn num_trainable_parameters(&self) -> usize
Source§fn memory_usage(&self) -> usize
fn memory_usage(&self) -> usize
Source§fn extra_repr(&self) -> String
fn extra_repr(&self) -> String
Source§fn register_hook(
&mut self,
_hook_type: HookType,
_callback: HookCallback,
) -> Option<HookHandle>
fn register_hook( &mut self, _hook_type: HookType, _callback: HookCallback, ) -> Option<HookHandle>
Source§fn remove_hook(&mut self, _hook_type: HookType, _handle: HookHandle) -> bool
fn remove_hook(&mut self, _hook_type: HookType, _handle: HookHandle) -> bool
Source§fn execute_hooks(
&self,
_hook_type: HookType,
_input: &Tensor,
_output: Option<&Tensor>,
) -> Result<()>
fn execute_hooks( &self, _hook_type: HookType, _input: &Tensor, _output: Option<&Tensor>, ) -> Result<()>
Source§fn forward_with_hooks(&self, input: &Tensor) -> Result<Tensor>
fn forward_with_hooks(&self, input: &Tensor) -> Result<Tensor>
Source§fn call(&self, input: &Tensor) -> Result<Tensor>
fn call(&self, input: &Tensor) -> Result<Tensor>
Source§fn apply(&self, input: &Tensor) -> Result<Tensor>
fn apply(&self, input: &Tensor) -> Result<Tensor>
Source§fn has_parameters(&self) -> bool
fn has_parameters(&self) -> bool
Source§fn has_children(&self) -> bool
fn has_children(&self) -> bool
Source§fn parameter_count(&self) -> usize
fn parameter_count(&self) -> usize
Source§fn trainable_parameter_count(&self) -> usize
fn trainable_parameter_count(&self) -> usize
Source§fn memory_usage_mb(&self) -> f64
fn memory_usage_mb(&self) -> f64
Source§fn toggle_training(&mut self)
fn toggle_training(&mut self)
Source§fn sequential_forward(modules: &[&dyn Module], input: Tensor) -> Result<Tensor>where
Self: Sized,
fn sequential_forward(modules: &[&dyn Module], input: Tensor) -> Result<Tensor>where
Self: Sized,
Source§fn batch_forward(&self, inputs: &[Tensor]) -> Result<Vec<Tensor>>
fn batch_forward(&self, inputs: &[Tensor]) -> Result<Vec<Tensor>>
Source§fn conditional_forward(&self, input: &Tensor, condition: bool) -> Result<Tensor>
fn conditional_forward(&self, input: &Tensor, condition: bool) -> Result<Tensor>
Source§fn residual_forward(&self, input: &Tensor) -> Result<Tensor>
fn residual_forward(&self, input: &Tensor) -> Result<Tensor>
Source§fn module_info(&self) -> ModuleInfo
fn module_info(&self) -> ModuleInfo
Source§fn check_training_readiness(&self) -> Result<()>
fn check_training_readiness(&self) -> Result<()>
Source§fn parameter_names_matching(&self, pattern: &str) -> Vec<String>
fn parameter_names_matching(&self, pattern: &str) -> Vec<String>
Source§fn parameters_by_type(&self, param_type: &str) -> HashMap<String, Parameter>
fn parameters_by_type(&self, param_type: &str) -> HashMap<String, Parameter>
Source§fn clone_parameters(&self) -> HashMap<String, Tensor>
fn clone_parameters(&self) -> HashMap<String, Tensor>
Source§fn diagnose(&self) -> ModuleDiagnostics
fn diagnose(&self) -> ModuleDiagnostics
Auto Trait Implementations§
impl !RefUnwindSafe for Sequential
impl !UnwindSafe for Sequential
impl Freeze for Sequential
impl Send for Sequential
impl Sync for Sequential
impl Unpin for Sequential
impl UnsafeUnpin for Sequential
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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