pub struct ProjectLayer<B: Backend> {
pub ffn_1: Conv1d<B>,
pub ffn_2: Linear<B>,
pub kernel_size: usize,
pub out_channels: usize,
}Fields§
§ffn_1: Conv1d<B>§ffn_2: Linear<B>§kernel_size: usize§out_channels: usizeImplementations§
Source§impl<B: Backend> ProjectLayer<B>
impl<B: Backend> ProjectLayer<B>
pub fn new( device: &B::Device, in_channels: usize, out_channels: usize, kernel_size: usize, ) -> Self
pub fn forward(&self, x: Tensor<B, 3>, _step: usize) -> Tensor<B, 3>
pub fn load_from_tensors<F>( device: &B::Device, get_tensor: &F, prefix: &str, in_channels: usize, out_channels: usize, ) -> Result<Self>
Trait Implementations§
Source§impl<B> AutodiffModule<B> for ProjectLayer<B>
impl<B> AutodiffModule<B> for ProjectLayer<B>
Source§type InnerModule = ProjectLayer<<B as AutodiffBackend>::InnerBackend>
type InnerModule = ProjectLayer<<B as AutodiffBackend>::InnerBackend>
Inner module without auto-differentiation.
Source§fn valid(&self) -> Self::InnerModule
fn valid(&self) -> Self::InnerModule
Returns the same module, but on the inner backend without auto-differentiation.
Source§fn from_inner(module: Self::InnerModule) -> Self
fn from_inner(module: Self::InnerModule) -> Self
Wraps an inner module back into an auto-diff module.
Source§impl<B: Backend> Clone for ProjectLayer<B>
impl<B: Backend> Clone for ProjectLayer<B>
Source§impl<B: Backend> Display for ProjectLayer<B>
impl<B: Backend> Display for ProjectLayer<B>
Source§impl<B> HasAutodiffModule<B> for ProjectLayer<B::InnerBackend>
impl<B> HasAutodiffModule<B> for ProjectLayer<B::InnerBackend>
Source§type TrainModule = ProjectLayer<B>
type TrainModule = ProjectLayer<B>
The module with auto-differentiation.
Source§impl<B: Backend> Module<B> for ProjectLayer<B>
impl<B: Backend> Module<B> for ProjectLayer<B>
Source§type Record = ProjectLayerRecord<B>
type Record = ProjectLayerRecord<B>
Type to save and load the module.
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 into_record(self) -> Self::Record
fn into_record(self) -> Self::Record
Convert the module into a record containing the state.
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 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§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 collect_devices(&self, devices: Devices<B>) -> Devices<B>
fn collect_devices(&self, devices: Devices<B>) -> Devices<B>
Return all the devices found in the underneath module tree added to the given vector
without duplicates.
Source§fn to_device(self, device: &B::Device) -> Self
fn to_device(self, device: &B::Device) -> Self
Move the module and all of its sub-modules to the given device. Read more
Source§fn fork(self, device: &B::Device) -> Self
fn fork(self, device: &B::Device) -> Self
Fork the module and all of its sub-modules to the given device. Read more
Source§fn devices(&self) -> Vec<<B as BackendTypes>::Device>
fn devices(&self) -> Vec<<B as BackendTypes>::Device>
Return all the devices found in the underneath module tree without duplicates.
Source§fn train<AB>(self) -> Self::TrainModulewhere
AB: AutodiffBackend<InnerBackend = B>,
Self: HasAutodiffModule<AB>,
fn train<AB>(self) -> Self::TrainModulewhere
AB: AutodiffBackend<InnerBackend = B>,
Self: HasAutodiffModule<AB>,
Move the module and all of its sub-modules to the autodiff backend. Read more
Source§fn save_file<FR, PB>(
self,
file_path: PB,
recorder: &FR,
) -> Result<(), RecorderError>
fn save_file<FR, PB>( self, file_path: PB, recorder: &FR, ) -> Result<(), RecorderError>
Save the module to a file using the provided file recorder. Read more
Source§fn load_file<FR, PB>(
self,
file_path: PB,
recorder: &FR,
device: &<B as BackendTypes>::Device,
) -> Result<Self, RecorderError>
fn load_file<FR, PB>( self, file_path: PB, recorder: &FR, device: &<B as BackendTypes>::Device, ) -> Result<Self, RecorderError>
Load the module from a file using the provided file recorder. Read more
Source§fn quantize_weights(self, quantizer: &mut Quantizer) -> Self
fn quantize_weights(self, quantizer: &mut Quantizer) -> Self
Quantize the weights of the module.
Source§impl<B: Backend> ModuleDisplay for ProjectLayer<B>
impl<B: Backend> ModuleDisplay for ProjectLayer<B>
Source§fn format(&self, passed_settings: DisplaySettings) -> String
fn format(&self, passed_settings: DisplaySettings) -> String
Formats the module with provided display settings. Read more
Source§fn custom_settings(&self) -> Option<DisplaySettings>
fn custom_settings(&self) -> Option<DisplaySettings>
Custom display settings for the module. Read more
Auto Trait Implementations§
impl<B> !Freeze for ProjectLayer<B>
impl<B> !RefUnwindSafe for ProjectLayer<B>
impl<B> !UnwindSafe for ProjectLayer<B>
impl<B> Send for ProjectLayer<B>
impl<B> Sync for ProjectLayer<B>
impl<B> Unpin for ProjectLayer<B>where
<B as BackendTypes>::FloatTensorPrimitive: Unpin,
<B as BackendTypes>::QuantizedTensorPrimitive: Unpin,
<B as BackendTypes>::Device: Unpin,
impl<B> UnsafeUnpin for ProjectLayer<B>where
<B as BackendTypes>::Device: UnsafeUnpin,
<B as BackendTypes>::FloatTensorPrimitive: UnsafeUnpin,
<B as BackendTypes>::QuantizedTensorPrimitive: 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<C> CloneExpand for Cwhere
C: Clone,
impl<C> CloneExpand for Cwhere
C: Clone,
fn __expand_clone_method(&self, _scope: &mut Scope) -> C
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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 moreimpl<T> MaybeSendSync for T
Source§impl<B, M> ModuleSnapshot<B> for M
impl<B, M> ModuleSnapshot<B> for M
Source§fn collect(
&self,
filter: Option<PathFilter>,
adapter: Option<Box<dyn ModuleAdapter>>,
skip_enum_variants: bool,
) -> Vec<TensorSnapshot>
fn collect( &self, filter: Option<PathFilter>, adapter: Option<Box<dyn ModuleAdapter>>, skip_enum_variants: bool, ) -> Vec<TensorSnapshot>
Collects tensor snapshots for inspection without copying data. Read more
Source§fn apply(
&mut self,
snapshots: Vec<TensorSnapshot>,
filter: Option<PathFilter>,
adapter: Option<Box<dyn ModuleAdapter>>,
skip_enum_variants: bool,
) -> ApplyResultwhere
Self: Sized,
fn apply(
&mut self,
snapshots: Vec<TensorSnapshot>,
filter: Option<PathFilter>,
adapter: Option<Box<dyn ModuleAdapter>>,
skip_enum_variants: bool,
) -> ApplyResultwhere
Self: Sized,
Applies tensor snapshots to the module. Read more
Source§fn save_into<P>(&self, store: &mut P) -> Result<(), <P as ModuleStore>::Error>where
P: ModuleStore,
fn save_into<P>(&self, store: &mut P) -> Result<(), <P as ModuleStore>::Error>where
P: ModuleStore,
Saves tensor snapshots into a
ModuleStore. Read moreSource§fn load_from<P>(
&mut self,
store: &mut P,
) -> Result<ApplyResult, <P as ModuleStore>::Error>where
P: ModuleStore,
fn load_from<P>(
&mut self,
store: &mut P,
) -> Result<ApplyResult, <P as ModuleStore>::Error>where
P: ModuleStore,
Loads tensor data from a
ModuleStore. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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