pub struct CpuGraph { /* private fields */ }
Implementations§
Trait Implementations§
Source§impl Graph for CpuGraph
impl Graph for CpuGraph
fn alloc_usize( &mut self, t: Tensor<usize>, name: String, ) -> Result<TensorId, GraphError>
fn alloc( &mut self, t: Tensor<f32>, is_param: bool, name: String, ) -> Result<TensorId, GraphError>
fn load<T: TensorOps<f32>>( &mut self, tensor_id: TensorId, tensor: &T, ) -> Result<(), GraphError>
fn load_usize<T: TensorOps<usize>>( &mut self, tensor_id: TensorId, tensor: &T, ) -> Result<(), GraphError>
fn load_grad<T: TensorOps<f32>>( &mut self, tensor_id: TensorId, tensor: &T, ) -> Result<(), GraphError>
fn zero_grad(&mut self) -> Result<(), GraphError>
fn name_of(&self, id: TensorId) -> Result<&String, GraphError>
fn get(&self, id: TensorId) -> Result<&GeneralTensor, GraphError>
fn get_grad(&self, id: TensorId) -> Result<&Tensor<f32>, GraphError>
fn backward_all( &mut self, id: TensorId, limit: Option<usize>, ) -> Result<f32, GraphError>
fn forward(&mut self, training: bool) -> Result<(), GraphError>
fn call( &mut self, f: Box<dyn Function>, tensor_ids: &[TensorId], ) -> Result<TensorId, GraphError>
fn optimize<O: Optimizer>( &mut self, optimizer: &O, learning_rate: f32, ) -> Result<(), GraphError>
fn fetch(&mut self, _tensor_id: TensorId, _grad: bool) -> Result<(), GraphError>
fn params(&self) -> &[TensorId]
fn optimizer_step(&self) -> usize
fn get_optimizer_state(&self) -> Result<OptimizerState, GraphError>
fn set_optimizer_state( &mut self, state: &OptimizerState, ) -> Result<(), GraphError>
impl Send for CpuGraph
impl Sync for CpuGraph
Auto Trait Implementations§
impl Freeze for CpuGraph
impl !RefUnwindSafe for CpuGraph
impl Unpin for CpuGraph
impl !UnwindSafe for CpuGraph
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 more