pub trait GpuOptimizer<A: Float, D: Dimension> {
// Required methods
fn is_gpu_available(&self) -> bool;
fn to_gpu(&mut self) -> Result<(), GpuOptimError>;
fn to_cpu(&mut self) -> Result<(), GpuOptimError>;
fn step_gpu(
&mut self,
params: &mut Array<A, D>,
gradients: &Array<A, D>,
) -> Result<(), GpuOptimError>;
}
Expand description
Trait for GPU-accelerated optimizers
Required Methods§
Sourcefn is_gpu_available(&self) -> bool
fn is_gpu_available(&self) -> bool
Check if GPU acceleration is available
Sourcefn to_gpu(&mut self) -> Result<(), GpuOptimError>
fn to_gpu(&mut self) -> Result<(), GpuOptimError>
Move optimizer state to GPU
Sourcefn to_cpu(&mut self) -> Result<(), GpuOptimError>
fn to_cpu(&mut self) -> Result<(), GpuOptimError>
Move optimizer state back to CPU