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

Flightdeck squared-hinge

Train a margin classifier with labels minus one or plus one and a squared margin deficit.

Source repository · Package JSON

Use Flightdeck squared-hinge

use vendor::fd_squared_hinge::squared_hinge;

Run the example

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

Expected output

module {
  func.func @main(%x: tensor<2x7xf32>, %label: tensor<2x7xf32>) -> (tensor<2x7xf32>, tensor<2x7xf32>) {
    %v0 = stablehlo.constant dense<0.00000000000000000e+00> : tensor<2x7xf32>
    %v1 = stablehlo.constant dense<1.00000000000000000e+00> : tensor<2x7xf32>
    %v2 = stablehlo.multiply %label, %x : tensor<2x7xf32>
    %v3 = stablehlo.subtract %v1, %v2 : tensor<2x7xf32>
    %v4 = stablehlo.maximum %v3, %v0 : tensor<2x7xf32>
    %v5 = stablehlo.multiply %v4, %v4 : tensor<2x7xf32>
    %v6 = stablehlo.constant dense<2.00000000000000000e+00> : tensor<2x7xf32>
    %v7 = stablehlo.negate %v6 : tensor<2x7xf32>
    %v8 = stablehlo.multiply %v7, %label : tensor<2x7xf32>
    %v9 = stablehlo.multiply %v8, %v4 : tensor<2x7xf32>
    return %v5, %v9 : tensor<2x7xf32>, tensor<2x7xf32>
  }
}

Published versions

VersionPackageSource commitSHA-256
0.1.1Download ZIP · Browse filesbf9c3d5003e9259fa49497905b9d4632bbb7482393b9ac7905ae72a5436c5cc3dc7fa61d38
0.1.0Download ZIP · Browse filesd5835c510933ee49c22506157fb82e9f8345b316d7198efaa779e1ef7bfb7461083a6f1eec