Skip to main content

asgd_step

Function asgd_step 

Source
pub fn asgd_step<T: Triton, const BLOCK_SIZE: i32>(
    params_ptr: T::Pointer<f32>,
    grad_ptr: T::Pointer<f32>,
    ax_ptr: T::Pointer<f32>,
    n_elements: i32,
    lr: f32,
    weight_decay: f32,
    d_ax: f32,
)
where T::I32Tensor: Tensor<i32, 1> + Comparison<i32, BoolTensor = T::BoolTensor>, T::Pointer<f32>: AddOffsets<i32, 1, T::I32Tensor, Output = T::Tensor<T::Pointer<f32>>>,
Expand description

ASGD step (Averaged SGD) — averaging-active phase (step > t0).

p  = p - lr * g
ax = ax + (p - ax) / d_ax        where d_ax = max(1, step - t0)

d_ax = max(1.0, step - t0) is precomputed on the host.

Grid: [ceil(n_elements / BLOCK_SIZE), 1, 1].