Involving the resource

Libtorch – win – Shared – with – deps – debug – 1.9.0 + CPU. Zip

dendisuhubdy__libtorch_examples

Pytorch v1.9.0 source: d69c22dd61a2f006dcfe1e3ea8468a3ecaf931aa is v1.9.0

Opencv -4.5.3-vc14_vc15.exe Opencv cmake configuration

Clion + VS2019 + Cmake development environment

General process record

Libtorch -win-shared-with-deps-debug-1.9.0+cpu.zip Check the build-hash content of the file. D69c22dd61a2f006dcfe1e3ea8468a3ecaf931aa to find the submit d69c22dd61a2f006dcfe1e3ea8468a3ecaf931aa pytorch source code, is v1.9.0

Libtorch -win-shared-with-deps-debug-1.9.0+cpu.zip: libtorch-win-shared-with-deps-debug-1.9.0+ CPU.

Single step debugging mnist.cpp

After a few steps into the code is actually CPP, but there is no CPP so it is shown as the following assembly instruction. The following figure shows a callq instruction: callq AutogradMetaInterface… .

The AutogradMetaInterface is actually in tensorimp.cpp, So click “Choose File” in the upper right corner and go to D:\local_external\ PyTorch \c10\core\ tensorimpl.cpp, The debugger’s symbol file. PDB will now correspond correctly to the PyTorch repository source file, and other pyTorch repository source files will be automatically mapped, so you can debug PyTorch CPP.

CPP const at::Tensor& TensorImpl::grad() const add a breakpoint and restart debugging. Debugging, as shown below: