問題
撰寫一個99乘法表,利用Placeholder(multi dimension)
程式碼
#載入tensorflow lib
import tensorflow as tf
# 宣告placeholder
x = tf.placeholder(tf.float32)
y = tf.placeholder(tf.float32, shape=(9))
z = x*y
arr = [i for i in range(1,10)]
with tf.Session() as sess:
for i in range(1,10):
res = sess.run(z, feed_dict={x: i,y: arr})
print(res)