美文网首页
《TensorFlow实战~》TF简易说明代码

《TensorFlow实战~》TF简易说明代码

作者: 晨箜 | 来源:发表于2017-11-28 21:11 被阅读0次

TensorFlow实战Google深度学习框架 charpter3

import tensorflow as tf

# 设置随机数种子seed
w1 = tf.Variable(tf.random_normal([2, 3], stddev=1, seed=1))
w2 = tf.Variable(tf.random_normal([3, 1], stddev=1, seed=1))

x = tf.constant([[0.7, 0.9]])

# 最简单的两层神经网络
a = tf.matmul(x, w1)
y = tf.matmul(a, w2)

sess = tf.Session()
# 初始化
sess.run(w1.initializer)
sess.run(w2.initializer)

print(sess.run(y))

sess.close()

Euniceu github

相关文章

网友评论

      本文标题:《TensorFlow实战~》TF简易说明代码

      本文链接:https://www.haomeiwen.com/subject/dkrebxtx.html