【发布时间】:2016-11-18 13:31:54
【问题描述】:
import tensorflow as tf
a=tf.int32
b=tf.constant(3)
a==b
给出错误而不是给出'false'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/dtypes.py", line 248, in __eq__
and self._type_enum == as_dtype(other).as_datatype_enum)
File "/usr/local/lib/python3.4/dist-packages/tensorflow/python/framework/dtypes.py", line 536, in as_dtype
if key == type_value:
TypeError: data type not understood
为什么会产生错误。我正在使用张量流 0.8 不应该能够检查任何变量是否相等。
我试图实现的是检查一个对象是否存在于列表中
a=tf.int32
b=[tf.constant(3),..other objects]
if a in b:
do_something()
【问题讨论】:
标签: python python-3.x tensorflow python-3.4