【发布时间】:2019-02-15 06:35:12
【问题描述】:
错误:
ValueError:形状必须为 2 级,但对于输入形状为 [6]、[6] 的“MatMul”(操作:“MatMul”)为 1 级。
import tensorflow as tf
with tf.device('/gpu:1'):
a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], name='a')
b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], name='b')
c = tf.matmul(a, b)
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
print(sess.run(c))
我不知道怎么了。非常感谢您的帮助。
【问题讨论】:
-
你期待什么结果?
-
a 和 b 相乘。
标签: tensorflow