[TRT] neumf/embedding_lookup: indices input must be Int32 when running ncf_20m.uff

Docker: nvcr.io/nvidia/tensorflow:19.08-py3
Linux ubuntu 16.04
GPU: V100
Nvidia driver 418.67
CUDA 10.1
CUDNN version
Python 3
Tensorflow 1.14
TensorRT 6.0.1.5

I have a uffparser issue when runing self-converted ncf model.
I created a .pb model for ncf using tensorflow docker, and converted it to uff files successfully. Below is the log info.
2019-12-09 09:01:28.125008: I tensorflow/stream_executor/platform/default/dso_loader.cc:42] Successfully opened dynamic library libcudart.so.10.1
WARNING: Logging before flag parsing goes to stderr.
W1209 09:01:29.586434 140589483484992 deprecation_wrapper.py:119] From /usr/local/lib/python3.6/dist-packages/uff/converters/tensorflow/conversion_helpers.py:18: The name tf.GraphDef is deprecated. Please use tf.compat.v1.GraphDef instead.

Loading ncf_20m.pb
W1209 09:01:29.588292 140589483484992 deprecation_wrapper.py:119] From /usr/local/lib/python3.6/dist-packages/uff/converters/tensorflow/conversion_helpers.py:227: The name tf.gfile.GFile is deprecated. Please use tf.io.gfile.GFile instead.

W1209 09:01:30.000069 140589483484992 deprecation_wrapper.py:119] From /usr/lib/python3.6/dist-packages/graphsurgeon/_utils.py:2: The name tf.NodeDef is deprecated. Please use tf.compat.v1.NodeDef instead.

UFF Version 0.6.5
=== Automatically deduced input nodes ===
[name: “user_input”
op: “Placeholder”
attr {
key: “dtype”
value {
type: DT_INT32
}
}
attr {
key: “shape”
value {
shape {
dim {
size: -1
}
}
}
}
, name: “item_input”
op: “Placeholder”
attr {
key: “dtype”
value {
type: DT_INT32
}
}
attr {
key: “shape”
value {
shape {
dim {
size: -1
}
}
}
}
]

=== Automatically deduced output nodes ===
[name: “neumf/output/BiasAdd”
op: “BiasAdd”
input: “neumf/output/MatMul”
input: “neumf/output/bias/read”
attr {
key: “T”
value {
type: DT_FLOAT
}
}
attr {
key: “data_format”
value {
s: “NHWC”
}
}
]

Using output node neumf/output/BiasAdd
Converting to UFF graph
DEBUG [/usr/local/lib/python3.6/dist-packages/uff/converters/tensorflow/converter.py:96] Marking [‘neumf/output/BiasAdd’] as outputs
No. nodes: 47
UFF Output written to ncf_20m.uff

But when I tried to use sampleMovieLens to run this model, I have the error which saide as below.
&&&& RUNNING TensorRT.sample_movielens # ./bin/sample_movielens
[11/09/2019-09:04:46] [I] Building and running a GPU inference engine for MLP NCF model…
[11/09/2019-09:04:47] [I] Begin parsing model…
[11/09/2019-09:04:48] [E] [TRT] neumf/embedding_lookup: indices input must be Int32
[11/09/2019-09:04:49] [E] [TRT] neumf/embedding_lookup_1: indices input must be Int32
[11/09/2019-09:04:52] [E] [TRT] neumf/embedding_lookup_2: indices input must be Int32
Segmentation fault (core dumped)

I have already modified the initializeSampleParams function in sampleMovieLens.cpp based on input and output.
***
params.uffFileName = locateFile(“ncf_20m.uff”, params.dataDirs);
params.embeddingVecSize = 32;
params.topKMovies = 1;
params.numMoviesPerUser = 100;
params.ratingInputFile = locateFile(“movielens_ratings.txt”, params.dataDirs);

params.inputTensorNames.push_back("user_input");
params.inputTensorNames.push_back("item_input");
params.outputTensorNames.push_back("neumf/output/BiasAdd");
***

Please help me for this problem.
Thanks!

Hi,

Can you please share the script & model file to reproduce the issue?

Meanwhile, could you please try to use “trtexec” command to test the model.
“trtexec” useful for benchmarking networks and would be faster and easier to debug the issue.
https://github.com/NVIDIA/TensorRT/tree/master/samples/opensource/trtexec

Another alternative is to convert your model to ONNX instead using tf2onnx and then convert to TensorRT using ONNX parser. Any layer that are not supported needs to be replaced by custom plugin.
https://github.com/onnx/tensorflow-onnx
https://github.com/onnx/onnx-tensorrt/blob/master/operators.md

Please refer to below sample for ONNX implementation:
https://github.com/NVIDIA/TensorRT/tree/master/samples/opensource/sampleOnnxMNIST

Thanks