Can't trace model using torch.jit.trace()

I tried to script a model using torch.jit.trace() but I always have this error:

TracerWarning: Output nr 1. of the traced function does not match the corresponding output of the Python function. Detailed error:
Tensor-likes are not close!

I used model.eval() like suggested in other similar problems but the problem persists.

I am using :

  • torch 2.0.0+cu117
  • Python 3.10.6

Hello Ahmed,
please provide us with your code, otherwise, it is impossible to help.

Which function are you trying to trace?