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

Flightdeck rope-pairs

Rotate even and odd feature pairs with supplied sine and cosine tables and backpropagate to the input pair.

Source repository · Package JSON

Use Flightdeck rope-pairs

use vendor::fd_rope_pairs::rope_pairs;

Run the example

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

Expected output

module {
  func.func @main(%even: tensor<2x7xf32>, %odd: tensor<2x7xf32>, %cosine: tensor<2x7xf32>, %sine: tensor<2x7xf32>, %grad_even: tensor<2x7xf32>, %grad_odd: tensor<2x7xf32>) -> (tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>) {
    %v0 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<2x7xf32>
    %v1 = stablehlo.multiply %even, %cosine : tensor<2x7xf32>
    %v2 = stablehlo.multiply %odd, %sine : tensor<2x7xf32>
    %v3 = stablehlo.subtract %v1, %v2 : tensor<2x7xf32>
    %v4 = stablehlo.multiply %even, %sine : tensor<2x7xf32>
    %v5 = stablehlo.multiply %odd, %cosine : tensor<2x7xf32>
    %v6 = stablehlo.add %v4, %v5 : tensor<2x7xf32>
    %v7 = stablehlo.multiply %grad_even, %cosine : tensor<2x7xf32>
    %v8 = stablehlo.multiply %grad_odd, %sine : tensor<2x7xf32>
    %v9 = stablehlo.add %v7, %v8 : tensor<2x7xf32>
    %v10 = stablehlo.multiply %grad_odd, %cosine : tensor<2x7xf32>
    %v11 = stablehlo.multiply %grad_even, %sine : tensor<2x7xf32>
    %v12 = stablehlo.subtract %v10, %v11 : tensor<2x7xf32>
    return %v3, %v6, %v9, %v12 : tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>, tensor<2x7xf32>
  }
}

Published versions

VersionPackageSource commitSHA-256
0.1.1Download ZIP · Browse filesbf9c3d5003479f1146fae12f3035647078fac2bd302f2c57d149daa64c95e45c40430808ca
0.1.0Download ZIP · Browse filesd5835c510984b137fb7cbeb030fe681d8d2d6291f1c7a805f6de0b6d2ede157b4d5905e013