uff.model.exceptions.UffException: Const node conversion requested, but node is not Const

Ubuntu 16.04
Python 3.5
CUDA 10.0
cuDNN 7.4 & 7.5
tensort 5.1.2
uff 0.6.3

Converting code:

uff_model = uff.from_tensorflow_frozen_model("xxxx.pb", ['train_net/analysis_net/gdn/truediv'], debug_mode=True)

Error log:

NOTE: UFF has been tested with TensorFlow 1.12.0. Other versions are not guaranteed to work
UFF Version 0.6.3
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:130] Debug Mode is ENABLED
=== Automatically deduced input nodes ===
[name: "input_image"
op: "Placeholder"
attr {
  key: "dtype"
  value {
    type: DT_FLOAT
  }
}
attr {
  key: "shape"
  value {
    shape {
      dim {
        size: 1
      }
      dim {
        size: 512
      }
      dim {
        size: 768
      }
      dim {
        size: 3
      }
    }
  }
}
, name: "is_train"
op: "Placeholder"
attr {
  key: "dtype"
  value {
    type: DT_BOOL
  }
}
attr {
  key: "shape"
  value {
    shape {
    }
  }
}
]
=========================================

DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:152] Enumerating outputs
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:251] Extracting name information from train_net/analysis_net/gdn/truediv
Using output node train_net/analysis_net/gdn/truediv
Converting to UFF graph
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:88] Creating new UFF metagraph: main
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:66] Converting RealDiv node train_net/analysis_net/gdn/truediv
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:71] Found input train_net/analysis_net/conv2d/BiasAdd
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:71] Found input train_net/analysis_net/gdn/Sqrt
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:46] For node train_net/analysis_net/gdn/truediv with op RealDiv, using conversion function: <function convert_div at 0x7f3638b8c268>
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:66] Converting Sqrt node train_net/analysis_net/gdn/Sqrt
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:71] Found input train_net/analysis_net/gdn/BiasAdd
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:46] For node train_net/analysis_net/gdn/Sqrt with op Sqrt, using conversion function: <function convert_sqrt at 0x7f3638b8cf28>
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:66] Converting BiasAdd node train_net/analysis_net/gdn/BiasAdd
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:71] Found input train_net/analysis_net/gdn/convolution
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:71] Found input train_net/analysis_net/gdn/sub
DEBUG [/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py:46] For node train_net/analysis_net/gdn/BiasAdd with op BiasAdd, using conversion function: <function convert_bias_add at 0x7f3638b8de18>
Traceback (most recent call last):
  File "2uff.py", line 10, in <module>
    auff_model = uff.from_tensorflow_frozen_model("TNG_simple.pb", ['train_net/analysis_net/gdn/truediv'], debug_mode=True)
  File "/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/conversion_helpers.py", line 233, in from_tensorflow_frozen_model
    return from_tensorflow(graphdef, output_nodes, preprocessor, **kwargs)
  File "/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/conversion_helpers.py", line 181, in from_tensorflow
    debug_mode=debug_mode)
  File "/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py", line 94, in convert_tf2uff_graph
    uff_graph, input_replacements, debug_mode=debug_mode)
  File "/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py", line 79, in convert_tf2uff_node
    op, name, tf_node, inputs, uff_graph, tf_nodes=tf_nodes, debug_mode=debug_mode)
  File "/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py", line 47, in convert_layer
    return cls.registry_[op](name, tf_node, inputs, uff_graph, **kwargs)
  File "/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter_functions.py", line 550, in convert_bias_add
    kwargs["tf_nodes"][biases_name])
  File "/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/converter.py", line 122, in convert_tf2numpy_const_node
    raise UffException("Const node conversion requested, but node is not Const\n" + str(tf_node))
uff.model.exceptions.UffException: Const node conversion requested, but node is not Const
name: "train_net/analysis_net/gdn/sub"
op: "Sub"
input: "train_net/analysis_net/gdn/Square"
input: "train_net/analysis_net/gdn/Const"
attr {
  key: "T"
  value {
    type: DT_FLOAT
  }
}

Model code:

topFlow = tf.layers.conv2d(topFlow, channel_feature, 3, 1, 'same')
topFlow = tf.contrib.layers.gdn(topFlow)

PB model:
https://drive.google.com/file/d/1kWNwS8A5SToZjOxajwG2n7cOMrakb-Kx/

Similar problem:
https://devtalk.nvidia.com/default/topic/1044259/tensorrt/uff-model-exceptions-uffexception-const-node-conversion-requested-but-node-is-not-const/
https://devtalk.nvidia.com/default/topic/1046767/facing-issue-converting-pb-protoburf-file-to-uff-file-of-a-keras-tensorflow-back-end-model-/

Neither of them has got a solution.

Hi lamanorange, Did you fix this problem?

Hi,
any update on this??

https://docs.nvidia.com/deeplearning/sdk/tensorrt-developer-guide/index.html#error-messaging

Hi lamanorange,

Facing the same issue. Were you able to find a fix for this problem?

I have encountered the same problem. Did anybody find a solution?

same here with TF 1.15 and Tensorrt 6

Seems that converting bidirection gru layer was the problem.