Hi, I create a network with TRT API, and load tf weights into the TRT network, but the results are different.
I think the weight format difference may lead to the problem. So i have some questions to ask:
(1) for the conv weights, TF uses RSCK ([filter_height, filter_width, input_depth, output_depth]) and TensorRT uses KCRS, so do i need to transpose the weights before feeding to the conv layers? but in the SAMPLEMNISTAPI, there is no tranpose to tf weights for TRT.
for my example:
w1 = weightMap[“tf_conv1”] #RSCK
transpose the tf weights???
conv1 = network.add_convolution(data, 32, (11,41), trt.infer.Weights(w1), b1)
(2) for the IScaleLayer, I set tensorrt.ScaleMode.CHANNEL. The TRT doc says that the channel dimension is assumed to be the third to last dimension, but TRT format is CHW, so do i need to transpose the input of ScaleLayer from CHW to HWC?
(3) for RNN layer, TRT docs says that tf weights format is data_lenhidden_size, while TRT expects hidden_sizedata_len, so should i need to transpose each gate weights of RNN cell?
(4) recently, tf can set data format like channel_first(NCHW) and channel_last(NHWC), so if I train a tf model with data_format=channel_first, are the tf weights format the same as TRT weights format? If so, does it mean I don’t need to convert TF weights for TRT?