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

Flightdeck adamw-step

Apply AdamW with decoupled decay, beta1=0.9 and beta2=0.999. Pass bias denominators 1-beta^step and nonnegative second moments.

Source repository · Package JSON

Use Flightdeck adamw-step

use vendor::fd_adamw_step::adamw_step;

Run the example

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

Expected output

module {
  func.func @main(%weight: tensor<2x7xf32>, %grad: tensor<2x7xf32>, %moment: tensor<2x7xf32>, %variance: tensor<2x7xf32>, %lr: tensor<2x7xf32>, %decay: tensor<2x7xf32>, %correction1: tensor<2x7xf32>, %correction2: tensor<2x7xf32>) -> (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, %moment : tensor<2x7xf32>
    %v3 = stablehlo.constant dense<1.00000000000000006e-01> : tensor<2x7xf32>
    %v4 = stablehlo.multiply %v3, %grad : tensor<2x7xf32>
    %v5 = stablehlo.add %v2, %v4 : tensor<2x7xf32>
    %v6 = stablehlo.constant dense<9.98999999999999999e-01> : tensor<2x7xf32>
    %v7 = stablehlo.multiply %v6, %variance : tensor<2x7xf32>
    %v8 = stablehlo.constant dense<1.00000000000000002e-03> : tensor<2x7xf32>
    %v9 = stablehlo.multiply %v8, %grad : tensor<2x7xf32>
    %v10 = stablehlo.multiply %v9, %grad : tensor<2x7xf32>
    %v11 = stablehlo.add %v7, %v10 : tensor<2x7xf32>
    %v12 = stablehlo.constant dense<1.00000000000000000e+00> : tensor<2x7xf32>
    %v13 = stablehlo.multiply %lr, %decay : tensor<2x7xf32>
    %v14 = stablehlo.subtract %v12, %v13 : tensor<2x7xf32>
    %v15 = stablehlo.multiply %weight, %v14 : tensor<2x7xf32>
    %v16 = stablehlo.divide %v5, %correction1 : tensor<2x7xf32>
    %v17 = stablehlo.multiply %lr, %v16 : tensor<2x7xf32>
    %v18 = stablehlo.divide %v11, %correction2 : tensor<2x7xf32>
    %v19 = stablehlo.sqrt %v18 : tensor<2x7xf32>
    %v20 = stablehlo.constant dense<1.00000000000000002e-08> : tensor<2x7xf32>
    %v21 = stablehlo.add %v19, %v20 : tensor<2x7xf32>
    %v22 = stablehlo.divide %v17, %v21 : tensor<2x7xf32>
    %v23 = stablehlo.subtract %v15, %v22 : tensor<2x7xf32>
    return %v23, %v5, %v11 : tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>
  }
}

Published versions

VersionPackageSource commitSHA-256
0.1.1Download ZIP · Browse filesbf9c3d50034baf4dfc6efb5de5195fd2d5a63dcd8c567adf5560b740e5ca82a4371e473e29
0.1.0Download ZIP · Browse filesd5835c5109b953d5048e4293026ce75f4d736c24b1d4f82761a9007ddbd2b18377a7895d54