我想通过C ++代码加载元图,然后加载检查点权重。要加载元图,我首先从它生成一个pb文件
with tf.Session() as sess:
new_saver = tf.train.import_meta_graph(root_dir + meta_graph)
tf.train.write_graph(sess.graph_def, root_dir, export_pb, as_text=False)
然后我使用选择性注册来生成所需的操作和内核
bazel-bin/tensorflow/python/tools/print_selective_registration_header --graphs=xinmei/rnn_dict/model_test.pb > tensorflow/core/framework/ops_to_register.h
接下来,我使用此注册编译我的runnable。但是,当我在Android设备上运行可执行文件时,它会显示
Error creating graph: Invalid argument: No OpKernel was registered to support Op 'Const' with these attrs. Registered devices: [CPU], Registered kernels:
<no registered kernels>
[[Node: save/RestoreV2_8/shape_and_slices = Const[_output_shapes=[[1]], dtype=DT_STRING, value=Tensor<type: string shape: [1] values: >]()]]
如何加载元图?这样做的动机是我想继续在我的Android设备上训练模型。