Registry / Framework

framework · v0.1.1
Flightdeck gradient-conflict
Project one task gradient away from a conflicting task gradient. Output the projected gradient and original row dot product.
Use Flightdeck gradient-conflict
use vendor::fd_gradient_conflict::gradient_conflict;
Run the example
nest demo fd_gradient_conflict@0.1.1
blyxc native-run fd_gradient_conflict-demo/main.blyx
Example source and expected output
use vendor::fd_gradient_conflict::gradient_conflict;
fn main() { fd_gradient_conflict(2, 7); }
Expected output
module {
func.func @main(%first: tensor<2x7xf32>, %second: tensor<2x7xf32>) -> (tensor<2x7xf32>, tensor<2x7xf32>) {
%v0 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<2x7xf32>
%v1 = stablehlo.multiply %first, %second : tensor<2x7xf32>
%v2 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<f32>
%v3 = stablehlo.reduce(%v1 init: %v2) applies stablehlo.add across dimensions = [1] : (tensor<2x7xf32>, tensor<f32>) -> tensor<2xf32>
%v4 = stablehlo.broadcast_in_dim %v3, dims = [0] : (tensor<2xf32>) -> tensor<2x7xf32>
%v5 = stablehlo.multiply %second, %second : tensor<2x7xf32>
%v6 = stablehlo.reduce(%v5 init: %v2) applies stablehlo.add across dimensions = [1] : (tensor<2x7xf32>, tensor<f32>) -> tensor<2xf32>
%v7 = stablehlo.broadcast_in_dim %v6, dims = [0] : (tensor<2xf32>) -> tensor<2x7xf32>
%v8 = stablehlo.minimum %v4, %v0 : tensor<2x7xf32>
%v9 = stablehlo.multiply %v8, %second : tensor<2x7xf32>
%v10 = stablehlo.constant dense<9.99999999999999945e-21> : tensor<2x7xf32>
%v11 = stablehlo.maximum %v7, %v10 : tensor<2x7xf32>
%v12 = stablehlo.divide %v9, %v11 : tensor<2x7xf32>
%v13 = stablehlo.subtract %first, %v12 : tensor<2x7xf32>
return %v13, %v4 : tensor<2x7xf32>, tensor<2x7xf32>
}
}
Published versions
| Version | Package | Source commit | SHA-256 |
|---|---|---|---|
| 0.1.1 | Download ZIP · Browse files | bf9c3d5003 | f387783546dd13c6011ba688ba1c45571de82d32b7921b51923c1e13bf479876 |
| 0.1.0 | Download ZIP · Browse files | d5835c5109 | 00b115b5e4e962a389b15e1d7eedeb73fe90d0cbc60bb476a1741d8909397b72 |