Hi,
Yes you can do it but since you are going into cpp land, you will need a cpp debugger.
If you have a cpp ide you may have a debugger in it.
To check stack traces and basic values without any graphical tool you can use gdb, but this is significantly less user friendly.
If you are not used to cpp debugger, it may be simpler to just add prints into the function and recompile pytorch with your prints. You can find here 77 some cpp dev tips for pytorch.