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

Flightdeck guidance-mix

Apply classifier-free guidance and report the RMS size of the conditional correction relative to the unconditional prediction.

Source repository · Package JSON

Use Flightdeck guidance-mix

use vendor::fd_guidance_mix::guidance_mix;

Run the example

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

Expected output

module {
  func.func @main(%conditional: tensor<2x7xf32>, %unconditional: tensor<2x7xf32>, %strength: tensor<2x7xf32>) -> (tensor<2x7xf32>, tensor<2x7xf32>) {
    %v0 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<2x7xf32>
    %v1 = stablehlo.subtract %conditional, %unconditional : tensor<2x7xf32>
    %v2 = stablehlo.multiply %strength, %v1 : tensor<2x7xf32>
    %v3 = stablehlo.add %unconditional, %v2 : tensor<2x7xf32>
    %v4 = stablehlo.multiply %v1, %v1 : tensor<2x7xf32>
    %v5 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<f32>
    %v6 = stablehlo.reduce(%v4 init: %v5) 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.constant dense<7.0> : tensor<2x7xf32>
    %v9 = stablehlo.divide %v7, %v8 : tensor<2x7xf32>
    %v10 = stablehlo.sqrt %v9 : tensor<2x7xf32>
    return %v3, %v10 : tensor<2x7xf32>, tensor<2x7xf32>
  }
}

Published versions

VersionPackageSource commitSHA-256
0.1.1Download ZIP · Browse filesbf9c3d5003bbd64f27bc0f67b3d9e72e19b7dd49801bdcca01f1b81121412da44e27944a1e
0.1.0Download ZIP · Browse filesd5835c5109b837c7116dc9d3d1c1656306f982cea6013b9c551e20330c7ca917fcf2a79321