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

Flightdeck teacher-ema

Advance an exponential-moving-average teacher and track the mean squared gap from the current student. Decay lies in [0,1].

Source repository · Package JSON

Use Flightdeck teacher-ema

use vendor::fd_teacher_ema::teacher_ema;

Run the example

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

Expected output

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

Published versions

VersionPackageSource commitSHA-256
0.1.1Download ZIP · Browse filesbf9c3d500368e2655f19dc5cf83666d70acec9db49d89375d2e939cfd482326ba80e7f2c69
0.1.0Download ZIP · Browse filesd5835c51096e9ba0a226105c5bdfca33105c21290aee4810d4e363210511083c8ef8e7b8be