The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

468448 (1) [Avatar] Offline
I have retrained Inception-v3 model using (Tensorflow) Python API and saved a standalone Graph in .pb form. I have also used a dropout layer before the final layer. I can successfully run inference on the graph in python. The code to generate predictions in python is as follows:

softmax_tensor = sess.graph.get_tensor_by_name('final_layer/final_result/Softmax:0')
predictions =, { 'DecodeJpeg/contents:0': image_data, 'final_layer/dropout/Placeholder:0': 1.})

The C++ counterpart of the python code is as follows:

string input_layer = "Mul";
string output_layer = "final_layer/dropout/Placeholder:0";
Status run_status = session->Run({{input_layer, resized_tensor}}, {output_layer}, {}, &outputs);

The C++ code ends up with the following error message:

"Running model failed: Invalid argument: You must feed a value for placeholder tensor 'final_layer/dropout/Placeholder"

What should I change in the above C++ code to remove this error? In other words, how do I change a placeholder value in the C++ code as in python code.
Nishant Shukla (52) [Avatar] Offline
Unfortunately, I'm not sure about the exact issue with the C++ code. This book is only about using Python, so you might want to look on StackOverflow for help using the C++ library.