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

Flightdeck adadelta-step

Track gradient and update energies for AdaDelta with decay 0.95. Return both histories for the next batch.

Source repository · Package JSON

Use Flightdeck adadelta-step

use vendor::fd_adadelta_step::adadelta_step;

Run the example

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

Expected output

module {
  func.func @main(%weight: tensor<2x7xf32>, %grad: tensor<2x7xf32>, %variance: tensor<2x7xf32>, %update_energy: tensor<2x7xf32>, %lr: tensor<2x7xf32>) -> (tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>) {
    %v0 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<2x7xf32>
    %v1 = stablehlo.constant dense<9.49999999999999956e-01> : tensor<2x7xf32>
    %v2 = stablehlo.multiply %v1, %variance : tensor<2x7xf32>
    %v3 = stablehlo.constant dense<5.00000000000000028e-02> : tensor<2x7xf32>
    %v4 = stablehlo.multiply %v3, %grad : tensor<2x7xf32>
    %v5 = stablehlo.multiply %v4, %grad : tensor<2x7xf32>
    %v6 = stablehlo.add %v2, %v5 : tensor<2x7xf32>
    %v7 = stablehlo.constant dense<9.99999999999999955e-07> : tensor<2x7xf32>
    %v8 = stablehlo.add %update_energy, %v7 : tensor<2x7xf32>
    %v9 = stablehlo.sqrt %v8 : tensor<2x7xf32>
    %v10 = stablehlo.multiply %v9, %grad : tensor<2x7xf32>
    %v11 = stablehlo.add %v6, %v7 : tensor<2x7xf32>
    %v12 = stablehlo.sqrt %v11 : tensor<2x7xf32>
    %v13 = stablehlo.divide %v10, %v12 : tensor<2x7xf32>
    %v14 = stablehlo.multiply %v1, %update_energy : tensor<2x7xf32>
    %v15 = stablehlo.multiply %v3, %v13 : tensor<2x7xf32>
    %v16 = stablehlo.multiply %v15, %v13 : tensor<2x7xf32>
    %v17 = stablehlo.add %v14, %v16 : tensor<2x7xf32>
    %v18 = stablehlo.multiply %lr, %v13 : tensor<2x7xf32>
    %v19 = stablehlo.subtract %weight, %v18 : tensor<2x7xf32>
    return %v19, %v6, %v17 : tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>
  }
}

Published versions

VersionPackageSource commitSHA-256
0.1.1Download ZIP · Browse filesbf9c3d5003dd10f190069735fe5490994b05655a7d44da4a3eaea0b3ba3db7203f9289ac9b
0.1.0Download ZIP · Browse filesd5835c5109a58ca68b6e9cfffe83f2c2436bf57b1613f5331afd1e81fddd964419e9c17828