Using TensorFlow, I'm trying to load a network in a C++ file, that I trained in Python. I'm saving a network with input tensor x
and output tensor y
on Python with:
with tf.Session(graph=tf.Graph()) as sess:
tf.saved_model.simple_save(sess, export_dir, inputs={"ob": x}, outputs={"out": y})
Then, following these examples, I'm doing this in my C file:
TF_Buffer* buffer = ReadBufferFromFile("graph.pb");
TF_Graph* graph = TF_NewGraph();
TF_Status* status = TF_NewStatus();
TF_ImportGraphDefOptions* opts = TF_NewImportGraphDefOptions();
TF_GraphImportGraphDef(graph, buffer, opts, status);
But I'm getting a TF_Status
error code TF_INVALID_ARGUMENT
when doing the TF_GraphImportGraphDef
call. The buffer is being loaded, I can print its length and get a value (192 in this case).
What should I do, or how can I do this? Using Bazel and the C++ API is not an option.