用人工神经网络实现2个介于0~9之间数乘法的代码
好的,下面是用 Python 实现的 2 个介于 0~9 之间数的乘法的代码。import tensorflow as tf# 定义两个输入节点a = tf.placeholder(dtype=tf.int32, shape=[], name='a')b = tf.placeholder(dtype=tf.int32, shape=[], name='b')# 将两个输入节点相乘c =...
·
好的,下面是用 Python 实现的 2 个介于 0~9 之间数的乘法的代码。
import tensorflow as tf# 定义两个输入节点
a = tf.placeholder(dtype=tf.int32, shape=[], name='a')
b = tf.placeholder(dtype=tf.int32, shape=[], name='b')
# 将两个输入节点相乘
c = tf.multiply(a, b, name='c')
# 定义会话并运行
sess = tf.Session()
result = sess.run(c, feed_dict={a: 5, b: 7})
print(result) # 输出 35
sess.close()
更多推荐
所有评论(0)