Registry / Framework

framework · v0.1.1
Flightdeck amsgrad-step
Track the maximum uncorrected second moment for AMSGrad and apply the bias-corrected step.
Use Flightdeck amsgrad-step
use vendor::fd_amsgrad_step::amsgrad_step;
Run the example
nest demo fd_amsgrad_step@0.1.1
blyxc native-run fd_amsgrad_step-demo/main.blyx
Example source and expected output
use vendor::fd_amsgrad_step::amsgrad_step;
fn main() { fd_amsgrad_step(2, 7); }
Expected output
module {
func.func @main(%weight: tensor<2x7xf32>, %grad: tensor<2x7xf32>, %moment: tensor<2x7xf32>, %variance: tensor<2x7xf32>, %previous_max: tensor<2x7xf32>, %lr: tensor<2x7xf32>, %correction1: tensor<2x7xf32>, %correction2: tensor<2x7xf32>) -> (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.maximum %previous_max, %v11 : tensor<2x7xf32>
%v13 = stablehlo.divide %v5, %correction1 : tensor<2x7xf32>
%v14 = stablehlo.multiply %lr, %v13 : tensor<2x7xf32>
%v15 = stablehlo.divide %v12, %correction2 : tensor<2x7xf32>
%v16 = stablehlo.sqrt %v15 : tensor<2x7xf32>
%v17 = stablehlo.constant dense<1.00000000000000002e-08> : tensor<2x7xf32>
%v18 = stablehlo.add %v16, %v17 : tensor<2x7xf32>
%v19 = stablehlo.divide %v14, %v18 : tensor<2x7xf32>
%v20 = stablehlo.subtract %weight, %v19 : tensor<2x7xf32>
return %v20, %v5, %v11, %v12 : tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>
}
}
Published versions
| Version | Package | Source commit | SHA-256 |
|---|---|---|---|
| 0.1.1 | Download ZIP · Browse files | bf9c3d5003 | b3a13279c58d7bcfbb1727fd67c4136945831765e831223ad76a0bc7249bffe0 |
| 0.1.0 | Download ZIP · Browse files | d5835c5109 | 91fcbe27cc76dcb5180d5f6405a4e8300ce76c29498ee4303aeddd064189ee0f |