TensorFlowSharp入门使用C#编写TensorFlow人工智能应用学习。
TensorFlow简单介绍
TensorFlow 是谷歌的第二代机器学习系统,按照谷歌所说,在某些基准测试中,TensorFlow的表现比第一代的DistBelief快了2倍。
TensorFlow 内建深度学习的扩展支持,任何能够用计算流图形来表达的计算,都可以使用TensorFlow。任何基于梯度的机器学习算法都能够受益于TensorFlow的自动分化(auto-differentiation)。通过灵活的Python接口,要在TensorFlow中表达想法也会很容易。
TensorFlow 对于实际的产品也是很有意义的。将思路从桌面GPU训练无缝搬迁到手机中运行。
示例Python代码:
import tensorflow as tfimport numpy as np# Create 100 phony x, y data points in NumPy, y = x * 0.1 + 0.3x_data = np.random.rand(100).astype(np.float32) y_data = x_data * 0.1 + 0.3# Try to find values for W and b that compute y_data = W * x_data + b# (We know that W should be 0.1 and b 0.3, but TensorFlow will# figure that out for us.)W = tf.Variable(tf.random_uniform([1], -1.0, 1.0)) b = tf.Variable(tf.zeros([1])) y = W * x_data + b# Minimize the mean squared errors.loss = tf.reduce_mean(tf.square(y - y_data)) optimizer = tf.train.GradientDescentOptimizer(0.5) train = optimizer.minimize(loss)# Before starting, initialize the variables. We will 'run' this first.init = tf.global_variables_initializer()# Launch the graph.sess =