Hi, I’m trying to implement a Yolo V3 by Tensorflow and tensorRT 3.0 GA on TX2, however, when I try to convert the .pb to .plan with UFFParser in python API, this is what happened:
Warning: No conversion function registered for layer: Pad yet.
Converting as custom op Pad convolutional_9/Pad
name: "convolutional_9/Pad"
op: "Pad"
input: "shortcut_2/Add"
input: "convolutional_9/Const"
attr {
key: "T"
value {
type: DT_FLOAT
}
}
attr {
key: "Tpaddings"
value {
type: DT_INT32
}
}
And of course, the conversion failed with below exception:
UFFParser: Validator error: convolutional_9/Pad: Unsupported operation _Pad
Failed to parse UFF
This is what I found in tensorRT’s doc, seems that padding should be supported in my case.
“Pad is supported if followed by one of these TensorFlow layers: Conv2D,
DepthwiseConv2dNative, MaxPool, and AvgPool”
From: https://docs.nvidia.com/deeplearning/sdk/tensorrt-developer-guide/index.html#support_op
This is what I found in Nvidia’s official demo code, which is almost the same as I adopt in my case.
From: https://docs.nvidia.com/deeplearning/sdk/tensorrt-api/topics/topics/workflows/tf_to_tensorrt.html#Training-a-Model-in-Tensorflow
def Conv2d(x, W, b, strides=1):
# Conv2D wrapper, with bias and relu activation
filter_size = W.get_shape().as_list()
pad_size = filter_size[0]//2
pad_mat = np.array([[0,0],[pad_size,pad_size],[pad_size,pad_size],[0,0]])
x = tf.pad(x, pad_mat)
x = tf.nn.conv2d(x, W, strides=[1, strides, strides, 1], padding='VALID')
x = tf.nn.bias_add(x, b)
return tf.nn.relu(x)
Is it because padding is only supported in the latest TensorRT 4.0 or only supported in C++ API?
Thank you.