D.G*_*chi 2 lookup-tables tensorflow
我尝试升级我需要计算查找表的成本函数:
tf_look_up_keys = tf.as_string(tf.range(0, int(N+1), dtype=tf.int32 ))
tf_look_up_values = ....an array of N+1 elements ....
tf.contrib.lookup.HashTable(tf.contrib.lookup.KeyValueTensorInitializer(tf_look_up_keys, tf_look_up_values), -1)
Run Code Online (Sandbox Code Playgroud)
但是当我开始会话时,它告诉我:
tensorflow.python.framework.errors_impl.FailedPreconditionError:表未初始化.
> [[Node: hash_table_Lookup = LookupTableFind[Tin=DT_STRING, Tout=DT_FLOAT, _class=["loc:@hash_table"],
> _device="/job:localhost/replica:0/task:0/cpu:0"](hash_table, AsString_1, hash_table/Const)]]
Run Code Online (Sandbox Code Playgroud)
我该怎么办?我可以通过哪种方式进行初始化(我尝试向上移动tf.global_variables_initializer()但是它导致了一个关于其他变量的抱怨列表,在此修改之前就可以了)谢谢,欢呼
您需要按表格对表格进行初始化tf.tables_initializer.或者,您可以使用MonitoredSession为您进行初始化.
| 归档时间: |
|
| 查看次数: |
3058 次 |
| 最近记录: |