WebSharper.TensorFlowJs

TensorFlow.js 4 bindings for F# — with WebSharper

Source

${notice}

Tensors & operations

Create a tensor with Tf.Tensor2d and run the core TensorFlow.js ops: Tf.Add, Tf.Mul, Tf.MatMul, Tf.Relu, Tf.Softmax, Tf.Sum and Tf.Mean. Results are read back with ArraySync().

${tensorOut}

Train a tiny model

A Tf.Sequential model with two Layers_Dense layers, compiled with the Adam optimizer and fitted to y = 2x + 1. The final loss comes from the training History; the prediction is a fresh Predict.

${modelOut}

Runtime

Tf.GetBackend() and Tf.Memory() report the active backend and the live tensor accounting.

backend
${backend}
tensors
${numTensors}
bytes
${numBytes}