Registry / Framework

framework · v0.1.1
Flightdeck glu-backward
Apply a sigmoid gate and return both activation and gate gradients for a gated linear unit.
Use Flightdeck glu-backward
use vendor::fd_glu_backward::glu_backward;
Run the example
nest demo fd_glu_backward@0.1.1
blyxc native-run fd_glu_backward-demo/main.blyx
Example source and expected output
use vendor::fd_glu_backward::glu_backward;
fn main() { fd_glu_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 %x, %v1 : tensor<2x7xf32>
%v3 = stablehlo.multiply %upstream, %v1 : tensor<2x7xf32>
%v4 = stablehlo.multiply %upstream, %x : tensor<2x7xf32>
%v5 = stablehlo.multiply %v4, %v1 : tensor<2x7xf32>
%v6 = stablehlo.constant dense<1.00000000000000000e+00> : tensor<2x7xf32>
%v7 = stablehlo.subtract %v6, %v1 : tensor<2x7xf32>
%v8 = stablehlo.multiply %v5, %v7 : tensor<2x7xf32>
return %v2, %v3, %v8 : tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>
}
}
Published versions
| Version | Package | Source commit | SHA-256 |
|---|---|---|---|
| 0.1.1 | Download ZIP · Browse files | bf9c3d5003 | efa6165f006e958589130a4468ced428f4e37f0f462de6724d405795000e8b2e |
| 0.1.0 | Download ZIP · Browse files | d5835c5109 | 1558175beae972ecfb4e2a0f887f3c3f19cdf2631fbc5cb9d724d582acc20716 |