pub struct Transformer { /* private fields */ }Expand description
Transformer block with causal self attention and several caching strategies.
Trait Implementations§
Source§impl Clone for Transformer
impl Clone for Transformer
Source§fn clone(&self) -> Transformer
fn clone(&self) -> Transformer
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Transformer
impl Debug for Transformer
Source§impl Display for Transformer
impl Display for Transformer
Source§impl Forwarder for Transformer
impl Forwarder for Transformer
Source§fn load(name: String, ctx: &Context) -> Result<Box<Self>>
fn load(name: String, ctx: &Context) -> Result<Box<Self>>
Create an instance of this object loading the specified layer(s) from a VarBuilder.
Source§fn forward<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
x: &'life1 Tensor,
index_pos: usize,
block_idx: usize,
ctx: &'life2 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Tensor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn forward<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
x: &'life1 Tensor,
index_pos: usize,
block_idx: usize,
ctx: &'life2 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Tensor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Applies a forward operation to the input tensor, does not require mutability.
Source§fn forward_mut<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
x: &'life1 Tensor,
index_pos: usize,
block_idx: usize,
ctx: &'life2 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Tensor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn forward_mut<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
x: &'life1 Tensor,
index_pos: usize,
block_idx: usize,
ctx: &'life2 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Tensor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Applies a forward operation to the input tensor, requires mutability.
Source§fn layer_name(&self) -> &str
fn layer_name(&self) -> &str
Return the layer name.
Source§fn forward_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
_x: &'life1 Tensor,
_batch: Vec<(String, usize, usize)>,
_ctx: &'life2 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Tensor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn forward_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
_x: &'life1 Tensor,
_batch: Vec<(String, usize, usize)>,
_ctx: &'life2 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Tensor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Applies a batch of forward operations to the input tensor.
fn goodbye<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Auto Trait Implementations§
impl Freeze for Transformer
impl !RefUnwindSafe for Transformer
impl Send for Transformer
impl Sync for Transformer
impl Unpin for Transformer
impl UnsafeUnpin for Transformer
impl !UnwindSafe for Transformer
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> 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>
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt 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 moreSource§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.