I’ve converted an open source implementation of a model to TensorRT. When I run the optimised model I get warnings about
X out of the last X calls to <function recreate_function.<locals>.restored_function_body at 0x.....> triggered tf.function retracing. It then says that there are three common causes (creating functions in a loop, passing different shaped tensors, and passing Python objects instead of tensors).
It shouldn’t be #1 as we’re resizing the input images to be consistent and passing them in one at a time, but how do I find whether it is number 2 or number 3? And in which function? Given that it is a non-trivial third-party model, how do you debug this and narrow down which is the real cause?