I met with the same problem. It works in Release mode, but not Debug mode.
Following the instructions at https://stackoverflow.com/questions/59006561/using-a-pytorch-model-in-c-application-on-windows 127 , I finnally managed to get it work.