AttributeError: 'Tensor' object has no attribute 'node'

Hi,

I’ve a tensorflow model which I’d like to convert to uff. When I run:

uff_model = uff.from_tensorflow(Ava_SSL_GAN_NCHW, ["Discriminator/Softmax"])

I get the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-71-9034f49554a9> in <module>()
----> 1 uff_model = uff.from_tensorflow(Ava_SSL_GAN_NCHW, ["Discriminator/Softmax"])
      2 print(uff_model)

/usr/lib/python3.5/dist-packages/uff/converters/tensorflow/conversion_helpers.py in from_tensorflow(graphdef, output_nodes, **kwargs)
     47     for i, name in enumerate(output_nodes):
     48         output_nodes[i] = tf2uff.convert_node_name_or_index_to_name(
---> 49             name, graphdef.node)
     50         if not quiet:
     51             print("Using output node", output_nodes[i])

AttributeError: 'Tensor' object has no attribute 'node'

Can someone help me please? I can’t find anything explaining why I’m getting this error.

If it helps, my tensorflow model is the discriminator in a GAN’s setup which I isolated from the whole architecture after trained my GAN.

Thanks

Ok I think I solved my problem Despite the fact that the function is from_tensorflow to uff you can’t use tensorflow model directly. You need to take some extra steps provided at https://docs.nvidia.com/deeplearning/sdk/tensorrt-api/topics/topics/workflows/tf_to_tensorrt.html:

graphdef = tf.get_default_graph()
frozen_graph = =as_graph_def(frozen_graph = tf.graph_util.convert_variables_to_constants(sess,
                                               graphdef,
                                               ["Discriminator/Softmax"])
tf_model = tf.graph_util.remove_training_nodes(frozen_graph)
uff_model = uff.from_tensorflow(tf_model, ["Discriminator/Softmax"])