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

Flightdeck error-feedback

Compress a gradient to one sign and one row scale and carry the untransmitted residual to the next step.

Source repository · Package JSON

Use Flightdeck error-feedback

use vendor::fd_error_feedback::error_feedback;

Run the example

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

Expected output

module {
  func.func @main(%grad: tensor<2x7xf32>, %residual: tensor<2x7xf32>) -> (tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>) {
    %v0 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<2x7xf32>
    %v1 = stablehlo.add %grad, %residual : tensor<2x7xf32>
    %v2 = stablehlo.abs %v1 : tensor<2x7xf32>
    %v3 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<f32>
    %v4 = stablehlo.reduce(%v2 init: %v3) applies stablehlo.add across dimensions = [1] : (tensor<2x7xf32>, tensor<f32>) -> tensor<2xf32>
    %v5 = stablehlo.broadcast_in_dim %v4, dims = [0] : (tensor<2xf32>) -> tensor<2x7xf32>
    %v6 = stablehlo.constant dense<7.0> : tensor<2x7xf32>
    %v7 = stablehlo.divide %v5, %v6 : tensor<2x7xf32>
    %v8 = stablehlo.sign %v1 : tensor<2x7xf32>
    %v9 = stablehlo.multiply %v7, %v8 : tensor<2x7xf32>
    %v10 = stablehlo.subtract %v1, %v9 : tensor<2x7xf32>
    return %v9, %v10, %v7 : tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>
  }
}

Published versions

VersionPackageSource commitSHA-256
0.1.1Download ZIP · Browse filesbf9c3d50037e1fed5974c718e171dd56258dcc68ede065e34f0f321a00058e0fa62b8cc94b
0.1.0Download ZIP · Browse filesd5835c51091c7d2d0d36a12bb5051f759d3494a5a586311078ce89384d349751ad09b7b08c