gpt4 book ai didi

python - 值错误 : Input 0 of node incompatible with expected float_ref. **

转载 作者:太空狗 更新时间:2023-10-29 21:57:47 25 4
gpt4 key购买 nike

我在尝试导入优化的卡住图时遇到异常。

# read pb into graph_def
with tf.gfile.GFile(pb_file, "rb") as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())

# import graph_def
with tf.Graph().as_default() as graph:
tf.import_graph_def(graph_def)

获取这一行的异常:

tf.import_graph_def(graph_def)

Traceback (most recent call last): File
"/home/automator/PycharmProjects/tensorflow/venv/lib/python3.5/site-
packages/tensorflow/python/framework/importer.py", line 489, in
import_graph_def graph._c_graph, serialized, options) # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.InvalidArgumentError: Input 0 of node
import/final_retrain_ops/Wx_plus_b/weights_quant/AssignMinLast was
passed float from
import/final_retrain_ops/Wx_plus_b/weights_quant/min:0 incompatible
with expected float_ref. During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "/snap/pycharm-community/64/helpers/pydev/pydevd.py", line 1664, in main() File "/snap/pycharm-community/64/helpers/pydev/pydevd.py", line 1658, in
main globals = debugger.run(setup['file'], None, None, is_module) File "/snap/pycharm-community/64/helpers/pydev/pydevd.py", line 1068, in run pydev_imports.execfile(file, globals, locals) # execute the script File
"/snap/pycharm-community/64/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/automator/PycharmProjects/tensorflow/tfliteme.py", line 389,
in printTensors("/home/automator/Desktop/cervix/optimized_model.pb")
File "/home/automator/PycharmProjects/tensorflow/tfliteme.py", line
374, in printTensors tf.import_graph_def(graph_def) File "/home/automator/PycharmProjects/tensorflow/venv/lib/python3.5/site-
packages/tensorflow/python/util/deprecation.py", line 432, in
new_func return func(*args, **kwargs) File "/home/automator/PycharmProjects/tensorflow/venv/lib/python3.5/site-
packages/tensorflow/python/framework/importer.py", line 493, in
import_graph_def raise ValueError(str(e)) ValueError: Input 0 of node import/final_retrain_ops/Wx_plus_b/weights_quant/AssignMinLast was
passed float from
import/final_retrain_ops/Wx_plus_b/weights_quant/min:0 incompatible
with

预期的 float_ref。

最佳答案

确保您的 pb_file 格式正确(类似于 this )并尝试在 import_graph_def() 的“name”参数中设置一些值尝试覆盖“导入”默认值,如下所示:

# read pb into graph_def
with tf.gfile.GFile(pb_file, "rb") as f:
graph_def = tf.GraphDef()
graph_def.ParseFromString(f.read())

# import graph_def
with tf.Graph().as_default() as graph:
tf.import_graph_def(graph_def, name='')

关于python - 值错误 : Input 0 of node incompatible with expected float_ref. **,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51084768/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com