1

I'm running seq2seq code in pycharm in order to study pytorch.

The code has many classes and these classes have many function.

I'd like to monitor value of objects in other function, so I'm running code in console one by one.

Is there any good way to this using debug?

I haven't done debug before.

Please help me..

Lucas Kim
  • 123
  • 2
  • 10

2 Answers2

1

I'm not familiar with these tools specifically, but here is how I would approach it. It's also kinda hard to express how to properly use a gui interactively through text, so if you are new to a debugger in general it might be good to start with some tutorials. Jetbrains has some PyCharm debugger tutorials online.

PyCharm debugger tutorial 1

PyCharm debugger tutorial 2

When you are running the debugger, set breakpoints and you can see all of the local variables in the scope to your current object. If you are wanting to monitor 2 places, you could set 2 breakpoints. Or you could stop at one and move forward (look at Step Over, F8 and Step Into, F7 until the second object is available. I think specifically for you I would look at the Debugger, Frames. Essentially you can jump backwards in time from your current breakpoint to where your current function was called, and so on and so forth for ~10 calls. This might get you what you are looking for, but it is somewhat project dependent unfortunately.

nanotek
  • 2,959
  • 15
  • 25
0

Please refer to my answer in Confused about tensor dimensions and batch sizes in pytorch for detail on debugging PyTorch with PyCharm.

Haha TTpro
  • 5,137
  • 6
  • 45
  • 71