pub struct State {
pub context: Context,
pub info: ModelInfo,
pub data: TensorGpu<f32, ReadWrite>,
}Fields§
§context: Context§info: ModelInfo§data: TensorGpu<f32, ReadWrite>Trait Implementations§
Source§impl State for State
impl State for State
Source§fn init_shape(&self) -> Shape
fn init_shape(&self) -> Shape
Shape of the initialized one-batch CPU state.
Source§fn att(&self, layer: usize) -> Result<TensorGpuView<'_, f32>, TensorError>
fn att(&self, layer: usize) -> Result<TensorGpuView<'_, f32>, TensorError>
The part of the state that is used in an
att layer.Source§fn ffn(&self, layer: usize) -> Result<TensorGpuView<'_, f32>, TensorError>
fn ffn(&self, layer: usize) -> Result<TensorGpuView<'_, f32>, TensorError>
The part of the state that is used in an
ffn layer.Source§fn load(&self, tensor: TensorCpu<f32>, batch: usize) -> Result<(), TensorError>
fn load(&self, tensor: TensorCpu<f32>, batch: usize) -> Result<(), TensorError>
Load a batch of the state from CPU to GPU.
Source§fn back(
&self,
batch: usize,
) -> BoxFuture<'_, Result<TensorCpu<f32>, TensorError>>
fn back( &self, batch: usize, ) -> BoxFuture<'_, Result<TensorCpu<f32>, TensorError>>
Read back a batch of the state from GPU to CPU.
Source§fn write(
&self,
tensor: TensorGpu<f32, ReadWrite>,
batch: usize,
) -> Result<(), TensorError>
fn write( &self, tensor: TensorGpu<f32, ReadWrite>, batch: usize, ) -> Result<(), TensorError>
Write into the state from a GPU tensor.
Auto Trait Implementations§
impl Freeze for State
impl !RefUnwindSafe for State
impl Send for State
impl Sync for State
impl Unpin for State
impl !UnwindSafe for State
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<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.