pub struct Chain<A, B> {
pub first: A,
pub second: B,
pub activation: Activation,
}
Expand description
One module applied to the output of another with an optional activation function in between.
Fields§
§first: A
§second: B
§activation: Activation
Implementations§
Trait Implementations§
Source§impl<'de, A, B> Deserialize<'de> for Chain<A, B>where
A: Deserialize<'de>,
B: Deserialize<'de>,
impl<'de, A, B> Deserialize<'de> for Chain<A, B>where
A: Deserialize<'de>,
B: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<A, B> Module for Chain<A, B>
impl<A, B> Module for Chain<A, B>
Source§fn shallow_clone(&self) -> Selfwhere
Self: Sized,
fn shallow_clone(&self) -> Selfwhere
Self: Sized,
Create a clone of this module sharing the same variables (tensors).
Source§fn clone_to_device(&self, device: Device) -> Selfwhere
Self: Sized,
fn clone_to_device(&self, device: Device) -> Selfwhere
Self: Sized,
Create a clone of this module on the given device. Read more
Source§fn variables(&self) -> Box<dyn Iterator<Item = &Tensor> + '_>
fn variables(&self) -> Box<dyn Iterator<Item = &Tensor> + '_>
Iterator over variables (tensors) managed by this module.
Source§fn trainable_variables(&self) -> Box<dyn Iterator<Item = &Tensor> + '_>
fn trainable_variables(&self) -> Box<dyn Iterator<Item = &Tensor> + '_>
Iterator over the trainable variables (tensors) managed by this module.
Source§fn has_cudnn_second_derivatives(&self) -> bool
fn has_cudnn_second_derivatives(&self) -> bool
Whether cuDNN supports second derivatives of this module.
Source§impl<'a, A, B> ModuleExtras<'a> for Chain<A, B>where
A: ModuleExtras<'a>,
B: ModuleExtras<'a>,
impl<'a, A, B> ModuleExtras<'a> for Chain<A, B>where
A: ModuleExtras<'a>,
B: ModuleExtras<'a>,
type Variables = Chain<<A as ModuleExtras<'a>>::Variables, <B as ModuleExtras<'a>>::Variables>
type TrainableVariables = Chain<<A as ModuleExtras<'a>>::TrainableVariables, <B as ModuleExtras<'a>>::TrainableVariables>
Source§fn variables(&'a self) -> Self::Variables
fn variables(&'a self) -> Self::Variables
Iterator over variables (tensors) managed by this module.
Source§fn trainable_variables(&'a self) -> Self::TrainableVariables
fn trainable_variables(&'a self) -> Self::TrainableVariables
Iterator over the trainable variables (tensors) managed by this module.
Source§impl<A, B> SeqIterative for Chain<A, B>where
A: SeqIterative,
B: SeqIterative,
impl<A, B> SeqIterative for Chain<A, B>where
A: SeqIterative,
B: SeqIterative,
Source§type State = (<A as SeqIterative>::State, <B as SeqIterative>::State)
type State = (<A as SeqIterative>::State, <B as SeqIterative>::State)
Sequence state managed by the module.
Source§fn initial_state(&self) -> Self::State
fn initial_state(&self) -> Self::State
Construct an initial state for the start of a new sequence.
Source§fn step(&self, state: &mut Self::State, input: &Tensor) -> Tensor
fn step(&self, state: &mut Self::State, input: &Tensor) -> Tensor
Transform the next value in the sequence. Read more
Source§impl<A, B> SeqPacked for Chain<A, B>
impl<A, B> SeqPacked for Chain<A, B>
Source§fn seq_packed(&self, inputs: &PackedTensor) -> PackedTensor
fn seq_packed(&self, inputs: &PackedTensor) -> PackedTensor
Apply a sequence-to-sequence transformation on a
PackedTensor
. Read moreimpl<A: Copy, B: Copy> Copy for Chain<A, B>
impl<A, B> StructuralPartialEq for Chain<A, B>
Auto Trait Implementations§
impl<A, B> Freeze for Chain<A, B>
impl<A, B> RefUnwindSafe for Chain<A, B>where
A: RefUnwindSafe,
B: RefUnwindSafe,
impl<A, B> Send for Chain<A, B>
impl<A, B> Sync for Chain<A, B>
impl<A, B> Unpin for Chain<A, B>
impl<A, B> UnwindSafe for Chain<A, B>where
A: UnwindSafe,
B: UnwindSafe,
Blanket Implementations§
Source§impl<T> AsModule for Twhere
T: Module,
impl<T> AsModule for Twhere
T: Module,
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 more