我想使用tf.contrib.framework.fuse_op
来融合图形以融合我的图形以进行更快的推理,但是当我调用api时
input_list = ["ac_input"]
output_list = ["Inference/Reshape"]
default_type = types_pb2.DT_FLOAT
new_graph = fuse_op( graph_def=graph_def, input_nodes=input_list, output_nodes=output_list, output_dtypes=[default_type for _ in output_list], output_quantized=False, op_name="trans_fused", op_type="CustomTfTransOp")
然后删除https://github.com/tensorflow/tensorflow/blob/r1.13/tensorflow/contrib/framework/python/framework/graph_util.py assert len(name_to_node[n].input) == 1
的123行,但是为什么assert
为什么呢?
通过上述更改,我可以返回并保存new_graph,但是在加载保存的图时出现错误
tensorflow.python.framework.errors_impl.NotFoundError:操作类型不正确 在ac2690上运行的二进制文件中注册了“ CustomTfTransOp”。确保 Op和Kernel都在运行此程序的二进制文件中注册 处理。请注意,如果要加载使用ops的已保存图形 从tf.contrib中访问(例如)tf.contrib.resampler 导入图形之前,因为contrib ops在 首先访问该模块。
融合运算符做什么?如果我想将add和mul操作融合在一起,是否应该添加op? “ fuse_op”是什么意思?