I am trying to use the NCS to run some low-level TensorFlow code (i.e., not train a NN but use TF's algebraic operations directly). As a simplified example of what I would eventually like to do, I have written Python code to create a TF graph that computes the number of iterations for a given point in the Mandelbrot set (code here: https://gist.github.com/riccardomurri/c293abc5a51a39a50512779dca72c727 )
Now the code runs correctly in TF on my laptop, but both
mvNCCompile fail with the same error:
$ mvNCCheck -in IN:0 -on OUT mandelbrot.meta ... (Python deprecation warnings removed) ... mvNCCheck v02.00, Copyright @ Intel Corporation 2017 ... (Python deprecation warnings removed) ... Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1327, in _do_call return fn(*args) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1312, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1420, in _call_tf_sessionrun status, run_metadata) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/errors_impl.py", line 516, in __exit__ c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.NotFoundError: Unsuccessful TensorSliceReader constructor: Failed to find any matching files for mandelbrot [[Node: save/RestoreV2 = RestoreV2[dtypes=[DT_INT32, DT_FLOAT, DT_FLOAT], _device="/job:localhost/replica:0/task:0/device:CPU:0"](_arg_save/Const_0_0, save/RestoreV2/tensor_names, save/RestoreV2/shape_and_slices)]]
mandelbrot.meta file is there and can be correctly read (and the graph computed) by the
mandelbrot_r.py program (link to code above). What am I doing wrong?
@riccardomurri When using the NCSDK with a TensorFlow model, the NCSDK expects either a pb file or a meta file, a data file and an index file. If you're using a meta file, make sure your data and index file are named with the same prefix. It looks like you may be missing those files (data and/or index) or they may be named differently from your meta file.
Hello @Tome_at_Intel , many many thanks for this explanation! One further question: what should be in the data and index files? (or equivalently, how do I produce the combined
.pb file?) Whn using TF's own
import_meta_graph, everything works fine on my laptop…
@riccardomurri You're welcomed. This Stackoverflow.com answer by T.K Bartel and trdgny may help helpful to you: https://stackoverflow.com/questions/41265035/tensorflow-why-there-are-3-files-after-saving-the-model. Summarizing the answer, you need to import the meta graph and re-save it. Try using the following code and let me know if it works for you.
with tf.Session() as sess: saver = tf.train.import_meta_graph(YOUR META GRAPH FILE HERE) save_path = saver.save(sess, "/tmp/model.ckpt") print("Model saved in file: %s" % save_path)