Registry / Framework

framework · v0.1.1
Flightdeck reglu-backward
Route feed-forward activations through a ReLU gate. At a zero gate choose the zero subgradient.
Use Flightdeck reglu-backward
use vendor::fd_reglu_backward::reglu_backward;
Run the example
nest demo fd_reglu_backward@0.1.1
blyxc native-run fd_reglu_backward-demo/main.blyx
Example source and expected output
use vendor::fd_reglu_backward::reglu_backward;
fn main() { fd_reglu_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.maximum %gate, %v0 : tensor<2x7xf32>
%v2 = stablehlo.multiply %x, %v1 : tensor<2x7xf32>
%v3 = stablehlo.multiply %upstream, %v1 : tensor<2x7xf32>
%v4 = stablehlo.compare GT, %gate, %v0, FLOAT : (tensor<2x7xf32>, tensor<2x7xf32>) -> tensor<2x7xi1>
%v5 = stablehlo.multiply %upstream, %x : tensor<2x7xf32>
%v6 = stablehlo.select %v4, %v5, %v0 : tensor<2x7xi1>, tensor<2x7xf32>
return %v2, %v3, %v6 : tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>
}
}
Published versions
| Version | Package | Source commit | SHA-256 |
|---|---|---|---|
| 0.1.1 | Download ZIP · Browse files | bf9c3d5003 | e6f01d32d2abfe0af6b77318f7b24fbbc7a12e1a4841556b86c960c90deac10b |
| 0.1.0 | Download ZIP · Browse files | d5835c5109 | 6c59651ee2e8884e1dd7a1de0fad0eac4ffb494b3d22028f431319775698fe9c |