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

Flightdeck logistic-loss

Compute stable binary cross entropy from logits and its derivative. Supply binary or soft targets in [0,1].

Source repository · Package JSON

Use Flightdeck logistic-loss

use vendor::fd_logistic_loss::logistic_loss;

Run the example

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

Expected output

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

Published versions

VersionPackageSource commitSHA-256
0.1.1Download ZIP · Browse filesbf9c3d500306218de0d7232082b9975ecae7d84c357063e467c6e57585e63bca1173edae7a
0.1.0Download ZIP · Browse filesd5835c510942abe91f6e0e6b4eaf3c5d841e17e7256928a9f74d4f841558085637c2df60d1