|
|
|
@@ -7,17 +7,37 @@ TensorFlow.NET is a member project of SciSharp stack. |
|
|
|
 |
|
|
|
|
|
|
|
### How to use |
|
|
|
Download the pre-compiled dll [here](tensorflowlib) and place it in the bin folder. |
|
|
|
|
|
|
|
```cs |
|
|
|
// import tensorflow.net |
|
|
|
using using Tensorflow; |
|
|
|
``` |
|
|
|
|
|
|
|
```cs |
|
|
|
using TensorFlowNET.Core; |
|
|
|
// Create a Constant op |
|
|
|
var a = tf.constant(4.0f); |
|
|
|
var b = tf.constant(5.0f); |
|
|
|
var c = tf.add(a, b); |
|
|
|
|
|
|
|
namespace TensorFlowNET.Examples |
|
|
|
using (var sess = tf.Session()) |
|
|
|
{ |
|
|
|
public class HelloWorld : IExample |
|
|
|
{ |
|
|
|
public void Run() |
|
|
|
{ |
|
|
|
var hello = tf.constant("Hello, TensorFlow!"); |
|
|
|
} |
|
|
|
} |
|
|
|
var o = sess.run(c); |
|
|
|
} |
|
|
|
``` |
|
|
|
|
|
|
|
```cs |
|
|
|
// Create a placeholder op |
|
|
|
var a = tf.placeholder(tf.float32); |
|
|
|
var b = tf.placeholder(tf.float32); |
|
|
|
var c = tf.add(a, b); |
|
|
|
|
|
|
|
using(var sess = tf.Session()) |
|
|
|
{ |
|
|
|
var feed_dict = new Dictionary<Tensor, object>(); |
|
|
|
feed_dict.Add(a, 3.0f); |
|
|
|
feed_dict.Add(b, 2.0f); |
|
|
|
|
|
|
|
var o = sess.run(c, feed_dict); |
|
|
|
} |
|
|
|
``` |