TensorFlow for .NET
TensorFlow for .NET by Lost Tech allows you to create, train, and use machine learning models with the full power of TensorFlow API on C#, F# or any other .NET language.
var input = tf.placeholder(tf.float32, new TensorShape(null, 1), name: "x");
var output = tf.placeholder(tf.float32, new TensorShape(null, 1), name: "y");
var hiddenLayer = tf.layers.dense(input, hiddenSize,
activation: tf.sigmoid_fn,
kernel_initializer: new ones_initializer(),
bias_initializer: new random_uniform_initializer(minval: -x1, maxval: -x0),
name: "hidden");
var model = tf.layers.dense(hiddenLayer, units: 1, name: "output");
var cost = tf.losses.mean_squared_error(output, model);
var training = new GradientDescentOptimizer(learning_rate: learningRate).minimize(cost);
Features
Access the full set of TensorFlow APIs
- Build computation graphs, and run them in sessions
- Use Keras-style high-level APIs
- Build fast data pipelines, keep logs and model checkpoints
- Use estimators and the full power of tf.contrib
- Use eager mode to transform data interactively
- Many more
Train and run models on any hardware platform: CPUs, GPUs, TPUs
Use distributed training features
Track your training progress with TensorBoard
Easily port numerous existing TensorFlow examples
- From simple numerical computation samples to state-of-art models like AlphaZero - the new world's Go champion by DeepMind.
- Our GPT-2 demo was built in one week just a month after OpenAI released their first model, and included both training and inference, demonstrating incredible time-to-market with LostTech.TensorFlow
Get started quickly with a collection of samples
Seek help with the growing community
Use C# for machine learning
- Static typing when possible, fallback to dynamic in corner cases
- IDE support: code completion, documentation hints for classes, functions, and parameters
- Support for C# 8.0 features, such as ranges
- Can be used from C# interactive, and C# kernel for Jupyter
LostTech.TensorFlow is about 18% faster than TensorFlow.NET on a CNN training benchmark
Comparison with TensorFlowSharp
| TensorFlow.NET | LostTech.TensorFlow | |
|---|---|---|
| Load TensorFlow models | ✓ | ✓ |
| Train existing models | ✓ | ✓ |
| Create new models with low-level API | ✓ | ✓ |
| Create new models with high-level API | ✗ | ✓ |
| Latest algorithms | Some | Most |
| Dependencies | TF | TF + Python |
| TensorBoard integration | ✗ | ✓ |
| Estimators | ✗ | ✓ |
| Dataset manipulation via tf.data | ✗ | ✓ |
| tf.contrib | ✗ | ✓* |
| Commercial support | ✗ | ✓ |
| Performance | 1x | 1.18x |
| TPU support | ✗ | ✓ |
| AMD GPU support | ✗ | ✓ |
Documentation & Tutorials
- Our Machine Learning Blog: cool samples, LostTech.TensorFlow news, etc
- See What's New in the latest version
- Getting started
- Reinforcement learning with Unity ML Agents
- Writing billion songs with C# and Deep Learning + Demo
- C# or NOT: train deep convolutional network to classify programming language from a code fragment
- .NET, TensorFlow, and the windmills of Kaggle
Photo credit: Florian Weihmann from Pexels
TensorFlow, the TensorFlow logo and any related marks are trademarks of Google Inc.