Torchscript code won’t be much faster. Torchscript doesn’t speed up your code by a factor of 2. If
If you reimplemented in libtorch and code is slow, also it will be with Torchscript.
Finally, I think you could avoid some list comprehension like with dense_cx and dense_cy