This is terribly hard to debug remotely. For me, something like this seems to arise most often when the headers you use in C++ and the library (torch) Python uses are out of sync, i.e. have different versions.
Best regards
Thomas