Cannot use pytorch model with TensorRT, because model uses int64

Tomas_Tomukas: <p>Hello, I am a student, working on an extra project that my professor gave me which is to convert the <a href="https://github.com/visionml/pytracking" rel="noopener nofollow ugc">pytracking</a> framework tomp101 algorithm to TensorRT.</p>
<p>Now I have successfully converted it to ONNX, but when converting to TensorRT, I get a warning that some int64 are clamped to int32. When running inference on Tensorrt, the accuracy is terrible.</p>
<p>When running my model through:<br>
polygraphy inspect model tomp101_head_latest3.onnx --show layers attrs weights</p>
<p>I see that half the model is in int64, so this explains why clamping produces such low accuracy</p>
<p>Anybody with more experience, can you please tell me how should I go about this issue? The good thing is that the pytracking framework has made it easy to retrain the model I we decided to do so.<br>
So do I just retrain the whole model and make sure that int32 is used instead?</p>
<p>As far as I can see all the weights are in float32, but other values, which I don’t know are int64<br>
<div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/d/2/d2dc504a0b12521993778805c71af4b28d0938e4.png" data-download-href="https://discuss.pytorch.org/uploads/default/d2dc504a0b12521993778805c71af4b28d0938e4" title="image"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/d/2/d2dc504a0b12521993778805c71af4b28d0938e4_2_690x388.png" alt="image" data-base62-sha1="u5mhTg815Re0Pi3JCzaQS2wO4tu" width="690" height="388" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/d/2/d2dc504a0b12521993778805c71af4b28d0938e4_2_690x388.png, https://discuss.pytorch.org/uploads/default/optimized/3X/d/2/d2dc504a0b12521993778805c71af4b28d0938e4_2_1035x582.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/d/2/d2dc504a0b12521993778805c71af4b28d0938e4_2_1380x776.png 2x" data-dominant-color="161717"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">1920×1080 184 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>like I mentioned, the model is pretty large, and as I can see a lot of it uses int64, so do I have to modify the pytorch code line by line, or can everything be done more easily?</p>
<p><a href="https://drive.google.com/file/d/1-itEFkapRXvYkKbknpFczqPFHyb3OrjK/view?usp=sharing" rel="noopener nofollow ugc">link to onnx model</a></p>
<p>If any more information, or the program code is required, please let me know.</p>
<p>THANK YOU!!!</p>
<p>P.S. If I try to run the model in onnx runtime, I get this error:</p>
<pre><code class="lang-auto">onnxruntime.capi.onnxruntime_pybind11_state.RuntimeException: [ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Non-zero status code returned while running Reshape node. Name:'/Reshape_7' Status Message: /onnxruntime_src/onnxruntime/core/providers/cpu/tensor/reshape_helper.h:28 onnxruntime::ReshapeHelper::ReshapeHelper(const onnxruntime::TensorShape&amp;, onnxruntime::TensorShapeVector&amp;, bool) i &lt; input_shape.NumDimensions() was false. The dimension with value zero exceeds the dimension size of the input tensor
</code></pre>
<p>As I understand (correct me if I’m wrong) a tensor of size 0 somehow gets created here, maybe this is bad? Or for TensorRT this doesn’t matter?</p>