TensorFlow前向传播
生活随笔
收集整理的這篇文章主要介紹了
TensorFlow前向传播
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
import tensorflow as tf#特征向量
x = tf.constant([[0.7, 0.9]])
print(x)#參數
weight1 = tf.constant([[0.2, 0.1, 0.4],[0.3, -0.5, 0.2]])
bias1 = tf.constant([[-0.5, 0.1, -0.1]])t = tf.constant([[0.09, 0.28, 0.36]])#參數
weight2 = tf.constant([[0.6],[0.1],[-0.2]])
bias2 = tf.constant([0.1])a = (tf.matmul(x, weight1) + bias1)
y = (tf.matmul(t, weight2) + bias2)with tf.Session() as sess:print(sess.run(a))print('y=%g' % sess.run(y))
總結
以上是生活随笔為你收集整理的TensorFlow前向传播的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Google深度揭秘TPU:一文看懂内部
- 下一篇: TensorFlow交叉熵