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

Flightdeck swiglu-backward

Run a SwiGLU gate and return gradients to both halves of a transformer feed-forward projection.

Source repository · Package JSON

Use Flightdeck swiglu-backward

use vendor::fd_swiglu_backward::swiglu_backward;

Run the example

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

Expected output

module {
  func.func @main(%x: tensor<2x7xf32>, %gate: tensor<2x7xf32>, %upstream: tensor<2x7xf32>) -> (tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>) {
    %v0 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<2x7xf32>
    %v1 = stablehlo.logistic %gate : tensor<2x7xf32>
    %v2 = stablehlo.multiply %gate, %v1 : tensor<2x7xf32>
    %v3 = stablehlo.multiply %x, %v2 : tensor<2x7xf32>
    %v4 = stablehlo.multiply %upstream, %v2 : tensor<2x7xf32>
    %v5 = stablehlo.multiply %upstream, %x : tensor<2x7xf32>
    %v6 = stablehlo.constant dense<1.00000000000000000e+00> : tensor<2x7xf32>
    %v7 = stablehlo.subtract %v6, %v1 : tensor<2x7xf32>
    %v8 = stablehlo.multiply %v2, %v7 : tensor<2x7xf32>
    %v9 = stablehlo.add %v1, %v8 : tensor<2x7xf32>
    %v10 = stablehlo.multiply %v5, %v9 : tensor<2x7xf32>
    return %v3, %v4, %v10 : tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>
  }
}

Published versions

VersionPackageSource commitSHA-256
0.1.1Download ZIP · Browse filesbf9c3d5003829285506515d68e99405e810398bfb7629117960859549ae7e36bf8d456c090
0.1.0Download ZIP · Browse filesd5835c5109f2fde61b73189f16d7e7e8af38899a6f926447e93d15d041f1aed35e2051aa17