【发布时间】:2019-02-07 16:02:21
【问题描述】:
sess = tf.InteractiveSession()
t = tf.expand_dims(tf.constant(list(range(9))), axis=1)
tf.where(t == 5).eval()
InvalidArgumentError (see above for traceback): WhereOp : Unhandled input dimensions: 0
[[Node: Where_16 = Where[T=DT_BOOL, _device="/job:localhost/replica:0/task:0/device:CPU:0"](Where_16/condition)]]
这里发生了什么? Numpy 中对应的代码与 np.where 有效。
【问题讨论】:
-
您不应该在会话范围内执行此操作吗?
-
这对你有用吗?
print( tf.where(tf.equal(t,5)).eval() ) -
你能发布更长的回溯吗?如果您尝试使用 Eager Execution 而不是交互式会话运行会发生什么?
标签: numpy tensorflow