alueError: node 'Placeholder' in input_map does not exist in graph (input_map entry: input_image:0->Placeholder:0)

System information

  • Have I written custom code:
  • OS Platform and Distribution (Windows 10):
  • TensorFlow installed from (binary):
  • TensorFlow version (1.15):
  • Python version(3.7.6):
  • CUDA/cuDNN version(10.0):
  • GPU model and memory(GTX 1660ti and 6GB):

Description of problem

I was running file.py but still, it is not running, I did some changes in the source file. Still, the placeholder error is the same. The code is also updated with this question. Kindly review and Help.

Source code / logs

minimal code

with tf.io.gfile.GFile(args.model, "rb") as f:
    graph_def = tf.compat.v1.GraphDef()
    graph_def.ParseFromString(f.read())

    with tf.Graph().as_default() as graph:
        generated_image_1, generated_image_2, generated_image_3, = tf.import_graph_def(
                graph_def, 
                input_map={'input_image' : input_tensor, 'short_edge_1' : short_edge_1, 'short_edge_2' : short_edge_2, 'short_edge_3' : short_edge_3}, 
                return_elements=['style_subnet/conv-block/resize_conv_1/output:0', 'enhance_subnet/resize_conv_1/output:0', 'refine_subnet/resize_conv_1/output:0'], 
                name=None, 
                op_dict=None, 
                producer_op_list=None  *#line number 55*
            )

short_edges = [int(e) for e in args.hierarchical_short_edges.split(',')]

error

(myenv) D:\subbu>python file.py --model=models/model.pb --input_image=test_images/image.jpg
2021-12-25 00:54:11.765889: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library cudart64_100.dll
input image -  test_images/image.jpg (1200, 630, 3)
WARNING:tensorflow:From file.py:55: calling import_graph_def (from tensorflow.python.framework.importer) with op_dict is deprecated and will be removed in a future version.
Instructions for updating:
Please file an issue at https://github.com/tensorflow/tensorflow/issues if you depend on this feature.
Traceback (most recent call last):
  File "C:\Users\subbu\myenv\lib\site-packages\tensorflow_core\python\framework\importer.py", line 501, in _import_graph_def_internal
    graph._c_graph, serialized, options)  # pylint: disable=protected-access
tensorflow.python.framework.errors_impl.InvalidArgumentError: node 'Placeholder' in input_map does not exist in graph (input_map entry: input_image:0->Placeholder:0)


During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "file.py", line 87, in <module>
    main()
  File "file.py", line 55, in main
    producer_op_list=None
  File "C:\Users\subbu\myenv\lib\site-packages\tensorflow_core\python\util\deprecation.py", line 507, in new_func
    return func(*args, **kwargs)
  File "C:\Users\subbu\myenv\lib\site-packages\tensorflow_core\python\framework\importer.py", line 405, in import_graph_def
    producer_op_list=producer_op_list)
  File "C:\Users\subbu\myenv\lib\site-packages\tensorflow_core\python\framework\importer.py", line 505, in _import_graph_def_internal
    raise ValueError(str(e))
ValueError: node 'Placeholder' in input_map does not exist in graph (input_map entry: input_image:0->Placeholder:0)

We see that you are using the old version of tensorflow (1.x) which is not supported.We recommend that you upgrade to 2.10.0 and let us know if the issue still persists. For more details please refer to Migrate from TensorFlow 1.x to TensorFlow 2. Thank you!