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

Flightdeck adagrad-step

Accumulate squared gradients and normalize each parameter update by its own history.

Source repository · Package JSON

Use Flightdeck adagrad-step

use vendor::fd_adagrad_step::adagrad_step;

Run the example

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

Expected output

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

Published versions

VersionPackageSource commitSHA-256
0.1.1Download ZIP · Browse filesbf9c3d5003e90c45f3972a463fac48b56101bbb9fe7f452ae759cacc375adc5876e26b00f3
0.1.0Download ZIP · Browse filesd5835c5109deab2ce2f02ad13b41f8b4b5408567a0a954efe5ef2e5f93e5016fef98e5b11e