TensorFlow.NET为TensorFlow提供.NET标准绑定。TensorFlow.NET是SciSharp的一个成员项目。
示例代码:
using Tensorflow;// Create a Constant opvar a = tf.constant(4.0f);var b = tf.constant(5.0f);var c = tf.add(a, b);using (var sess = tf.Session()){ var o = sess.run(c);}// Create a placeholder opvar 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);}
评论