Blyx Nest Blyx language
Registry / Framework
framework · v0.1.1

Flightdeck nesterov-step

Advance a momentum buffer and apply the look-ahead gradient used by Nesterov SGD. Momentum is 0.9.

Source repository · Package JSON

Use Flightdeck nesterov-step

use vendor::fd_nesterov_step::nesterov_step;

Run the example

nest demo fd_nesterov_step@0.1.1
blyxc native-run fd_nesterov_step-demo/main.blyx
Example source and expected output
use vendor::fd_nesterov_step::nesterov_step;
fn main() { fd_nesterov_step(2, 7); }

Expected output

module {
  func.func @main(%weight: tensor<2x7xf32>, %grad: tensor<2x7xf32>, %velocity: tensor<2x7xf32>, %lr: tensor<2x7xf32>) -> (tensor<2x7xf32>, tensor<2x7xf32>) {
    %v0 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<2x7xf32>
    %v1 = stablehlo.constant dense<9.00000000000000022e-01> : tensor<2x7xf32>
    %v2 = stablehlo.multiply %v1, %velocity : tensor<2x7xf32>
    %v3 = stablehlo.add %v2, %grad : tensor<2x7xf32>
    %v4 = stablehlo.multiply %v1, %v3 : tensor<2x7xf32>
    %v5 = stablehlo.add %grad, %v4 : tensor<2x7xf32>
    %v6 = stablehlo.multiply %lr, %v5 : tensor<2x7xf32>
    %v7 = stablehlo.subtract %weight, %v6 : tensor<2x7xf32>
    return %v7, %v3 : tensor<2x7xf32>, tensor<2x7xf32>
  }
}

Published versions

VersionPackageSource commitSHA-256
0.1.1Download ZIP · Browse filesbf9c3d5003f558f424cc4676239b5f56e158db9a97039a979a29cf13df5f7d0c72728b9bec
0.1.0Download ZIP · Browse filesd5835c510978179f1371bcee9613917fa72e2486825d238a8a9344d61ae7922834ba093b70