pub struct GpuAdamW { /* private fields */ }Expand description
GPU AdamW with decoupled weight decay: the decay term is applied to the parameter and never enters the moment estimates.
Implementations§
Source§impl GpuAdamW
impl GpuAdamW
Sourcepub fn new(params: AdamParams) -> Result<Self, GpuOptimError>
pub fn new(params: AdamParams) -> Result<Self, GpuOptimError>
Create the optimizer with the default WebGPU backend.
Sourcepub fn with_config(
params: AdamParams,
config: GpuOptimizerConfig,
) -> Result<Self, GpuOptimError>
pub fn with_config( params: AdamParams, config: GpuOptimizerConfig, ) -> Result<Self, GpuOptimError>
Create the optimizer on an explicit backend.
Sourcepub fn backend(&self) -> GpuBackend
pub fn backend(&self) -> GpuBackend
Backend actually in use.
Sourcepub fn move_to_gpu(&mut self) -> Result<(), GpuOptimError>
pub fn move_to_gpu(&mut self) -> Result<(), GpuOptimError>
Upload the optimizer state to device memory.
Inherent alias for GpuOptimizer::move_to_gpu so callers do
not need a turbofish to pin the unused dimension parameter.
Sourcepub fn move_to_cpu(&mut self) -> Result<(), GpuOptimError>
pub fn move_to_cpu(&mut self) -> Result<(), GpuOptimError>
Download the optimizer state back to host memory.
Inherent alias for GpuOptimizer::move_to_cpu; see
Self::move_to_gpu.
Sourcepub fn to_gpu(&mut self) -> Result<(), GpuOptimError>
👎Deprecated since 0.3.2: renamed to move_to_gpu
pub fn to_gpu(&mut self) -> Result<(), GpuOptimError>
renamed to move_to_gpu
Deprecated alias for Self::move_to_gpu.
Sourcepub fn to_cpu(&mut self) -> Result<(), GpuOptimError>
👎Deprecated since 0.3.2: renamed to move_to_cpu
pub fn to_cpu(&mut self) -> Result<(), GpuOptimError>
renamed to move_to_cpu
Deprecated alias for Self::move_to_cpu.
Sourcepub fn is_gpu_available(&self) -> bool
pub fn is_gpu_available(&self) -> bool
Whether a real device (not the CPU fallback) is backing this optimizer.
Sourcepub fn step_count(&self) -> u64
pub fn step_count(&self) -> u64
Number of updates applied so far (1-based bias correction input).
Sourcepub fn params(&self) -> &AdamParams
pub fn params(&self) -> &AdamParams
Current hyper-parameters.
Sourcepub fn set_params(&mut self, params: AdamParams) -> Result<(), GpuOptimError>
pub fn set_params(&mut self, params: AdamParams) -> Result<(), GpuOptimError>
Replace the hyper-parameters, validating them first.
Trait Implementations§
Source§impl<D: Dimension> GpuOptimizer<f32, D> for GpuAdamW
impl<D: Dimension> GpuOptimizer<f32, D> for GpuAdamW
Source§fn is_gpu_available(&self) -> bool
fn is_gpu_available(&self) -> bool
Source§fn move_to_gpu(&mut self) -> Result<(), GpuOptimError>
fn move_to_gpu(&mut self) -> Result<(), GpuOptimError>
Source§fn move_to_cpu(&mut self) -> Result<(), GpuOptimError>
fn move_to_cpu(&mut self) -> Result<(), GpuOptimError>
Source§fn step_gpu(
&mut self,
params: &mut Array<f32, D>,
gradients: &Array<f32, D>,
) -> Result<(), GpuOptimError>
fn step_gpu( &mut self, params: &mut Array<f32, D>, gradients: &Array<f32, D>, ) -> Result<(), GpuOptimError>
Source§fn to_gpu(&mut self) -> Result<(), GpuOptimError>
fn to_gpu(&mut self) -> Result<(), GpuOptimError>
renamed to move_to_gpu
Self::move_to_gpu. Read moreSource§fn to_cpu(&mut self) -> Result<(), GpuOptimError>
fn to_cpu(&mut self) -> Result<(), GpuOptimError>
renamed to move_to_cpu
Self::move_to_cpu. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for GpuAdamW
impl !UnwindSafe for GpuAdamW
impl Freeze for GpuAdamW
impl Send for GpuAdamW
impl Sync for GpuAdamW
impl Unpin for GpuAdamW
impl UnsafeUnpin for GpuAdamW
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
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> ⓘ
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