Warning: No conversion function registered for layer: [Cast ,TensorArrayGatherV3 ]

Running following code

filename: uff1.py

import tensorflow as tf
from tensorflow.examples.tutorials.mnist import input_data

import tensorrt as trt
from tensorrt.parsers import uffparser


import pycuda.driver as cuda
import pycuda.autoinit
import numpy as np
from random import randint # generate a random test case
from PIL import Image
from matplotlib.pyplot import imshow #to show test case
import time #import system tools
import os

import uff

uff_model = uff.from_tensorflow_frozen_model('./rcnn_3chan.pb', ['image_tensor','detection_scores','detection_boxes' ,'detection_classes' ,'num_detections'])

parser.register_output("image_tensor")
parser.register_output("detection_scores")
parser.register_output("detection_boxes")
parser.register_output("detection_classes")
parser.register_output("num_detections")

[/code]

my ENV in bashrc:

export PATH=$PATH:/usr/local/cuda-9.0/bin/:/home/fts/Downloads/TensorRT-3.0.4/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/fts/Downloads/TensorRT-3.0.4/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-9.0/lib64:/usr/local/lib/x86_64-linux-gnu:/usr/local/cuda-9.0/lib64:/usr/local/lib/x86_64-linux-gnu
export CUDA_ROOT=/usr/local/cuda-9.0
export PATH=/usr/local/cuda-9.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export CUDA_HOME=/usr/local/cuda-9.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda/extras/CUPTI/lib64

Error:

WARNING:tensorflow:From /usr/local/lib/python2.7/dist-packages/tensorflow/contrib/learn/python/learn/datasets/base.py:198: retry (from tensorflow.contrib.learn.python.learn.datasets.base) is deprecated and will be removed in a future version.
Instructions for updating:
Use the retry module or similar alternatives.
Using output node image_tensor
Using output node detection_scores
Using output node detection_boxes
Using output node detection_classes
Using output node num_detections
Converting to UFF graph
Warning: No conversion function registered for layer: Identity yet.
Converting as custom op Identity num_detections
name: "num_detections"
op: "Identity"
input: "SecondStagePostprocessor/ToFloat_1"
attr {
  key: "T"
  value {
    type: DT_FLOAT
  }
}

Warning: No conversion function registered for layer: Cast yet.
Converting as custom op Cast SecondStagePostprocessor/ToFloat_1
name: "SecondStagePostprocessor/ToFloat_1"
op: "Cast"
input: "SecondStagePostprocessor/BatchMultiClassNonMaxSuppression/map/TensorArrayStack_4/TensorArrayGatherV3"
attr {
  key: "DstT"
  value {
    type: DT_FLOAT
  }
}
attr {
  key: "SrcT"
  value {
    type: DT_INT32
  }
}

Warning: No conversion function registered for layer: TensorArrayGatherV3 yet.
Converting as custom op TensorArrayGatherV3 SecondStagePostprocessor/BatchMultiClassNonMaxSuppression/map/TensorArrayStack_4/TensorArrayGatherV3
name: "SecondStagePostprocessor/BatchMultiClassNonMaxSuppression/map/TensorArrayStack_4/TensorArrayGatherV3"
op: "TensorArrayGatherV3"
input: "SecondStagePostprocessor/BatchMultiClassNonMaxSuppression/map/TensorArray_8"
input: "SecondStagePostprocessor/BatchMultiClassNonMaxSuppression/map/TensorArrayStack_4/range"
input: "SecondStagePostprocessor/BatchMultiClassNonMaxSuppression/map/while/Exit_5"
attr {
  key: "_class"
  value {
    list {
      s: "loc:@SecondStagePostprocessor/BatchMultiClassNonMaxSuppression/map/TensorArray_8"
    }
  }
}
attr {
  key: "dtype"
  value {
    type: DT_INT32
  }
}
attr {
  key: "element_shape"
  value {
    shape {
    }
  }
}

Traceback (most recent call last):
  File "uff1.py", line 19, in <module>
    uff_model = uff.from_tensorflow_frozen_model('./rcnn_3chan.pb', ['image_tensor','detection_scores','detection_boxes' ,'detection_classes' ,'num_detections'])
  File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/conversion_helpers.py", line 103, in from_tensorflow_frozen_model
    return from_tensorflow(graphdef, output_nodes, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/conversion_helpers.py", line 75, in from_tensorflow
    name="main")
  File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 64, in convert_tf2uff_graph
    uff_graph, input_replacements)
  File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 51, in convert_tf2uff_node
    op, name, tf_node, inputs, uff_graph, tf_nodes=tf_nodes)
  File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 28, in convert_layer
    fields = cls.parse_tf_attrs(tf_node.attr)
  File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 177, in parse_tf_attrs
    for key, val in attrs.items()}
  File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 177, in <dictcomp>
    for key, val in attrs.items()}
  File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 172, in parse_tf_attr_value
    return cls.convert_tf2uff_field(code, val)
  File "/usr/local/lib/python2.7/dist-packages/uff/converters/tensorflow/converter.py", line 161, in convert_tf2uff_field
    if shp.unknown_rank:
AttributeError: 'google.protobuf.pyext._message.RepeatedCompositeCo' object has no attribute 'unknown_rank'

Hi,

This error occurs when converting a TensorFlow model containing non-supported layers.

Please remember to check if all the layers in your model is supported by TensorRT.
Here is our supported layer information for your reference:
[url]Developer Guide :: NVIDIA Deep Learning TensorRT Documentation

Thanks.

But that’s not really a solution, is it?

I am facing the same problem with TensorRT 4.0. My model contains nodes such as “Cast”, “Identity”, “StridedSlice”, “TensorArrayGatherV3”, etc.

We have to get this model to run in TensorRT one way or another. Changing to another model is not an option.

Are there any workarounds? Is it possible to use the UFF parser for supported nodes, and then manually convert the unsupported ones? Are there any documents that cover nodes/layers not yet supported by the UFF parser?

Thanks,
Robby

Hi,

If you are using TensorRT 4.0 (x86-based), you can add your implementation for non-supported layer now.

Uff parser for plugin layer is supported from TensorRT 4.0.
You can add your implementation with plugin API with x86 TensorRT package.

For example,
If you are using Caffe as training frameworks, there are some new non-supported layer inside your model.
You can integrate the GPU code from Caffe branch to the TensorRT plugin interface, and link it with uff parser.

Thanks.

hi AastaLLL, does TensorRT 4.0 support layers for models trained with the Keras framework (TensorFlow backend)? I am getting these errors with 2 different models trained and frozen using Keras:

Errors: subgraph conversion error for subgraph_index:15 due to:“Unimplemented: Not supported constant type, at batch_normalization_52/Const_1” SKIPPING…( 447 nodes)

Errors: subgraph conversion error for subgraph_index:49 due to: “Unimplemented: Not supported constant type, at bn2a_branch2c_1/Const_5” SKIPPING…( 9 nodes)

Thanks

Hi,

It depends on the layer you used.

Please check the detail supported layer in our document:
[url]https://docs.nvidia.com/deeplearning/sdk/tensorrt-support-matrix/index.html#layers-matrix[/url]

Thanks.

Hi, as you have said,“You can add your implementation with plugin API with x86 TensorRT package.”
OK, now I know the non-supported layer can be solved by plugin API, but does “with x86 TensorRT package” meaning that the plugin API can’t be used in the TensorRT4.0 of Drive PX2 SDK?
Because I’m working on drive px2 platform now, I want to confirm this, it’s very important for me.

UFF Version 0.5.5
=== Automatically deduced input nodes ===
[name: “input”
op: “Placeholder”
attr {
key: “dtype”
value {
type: DT_FLOAT
}
}
attr {
key: “shape”
value {
shape {
dim {
size: -1
}
dim {
size: 224
}
dim {
size: 224
}
dim {
size: 3
}
}
}
}
]

Using output node output
Converting to UFF graph
Warning: No conversion function registered for layer: ArgMax yet.
Converting output as custom op: ArgMax
Warning: No conversion function registered for layer: AddV2 yet.
Converting fc8/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting fc7/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting fc6/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting conv5_3/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting conv5_2/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting conv5_1/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting conv4_3/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting conv4_2/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting conv4_1/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting conv3_3/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting conv3_2/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting conv3_1/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting conv2_2/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting conv2_1/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting conv1_2/add as custom op: AddV2
Warning: No conversion function registered for layer: AddV2 yet.
Converting conv1_1/add as custom op: AddV2
No. nodes: 92

how to solve this Warning?

@823129275, Did you find a solution to this problem? if so, can you share? Thanks