How to debug internal function and variable in gluoncv


For example, I want to use pdb to set a breakpoint at hybrid_forward function of class RPN

b /home/user/.local/lib/python3.6/site-packages/gluoncv-0.3.0-py3.6.egg/gluoncv/model_zoo/rpn/

And yet I find program stop at a strange place:

def empty(shape, ctx=None, dtype=None, stype=None):
“”"Returns a new array of given shape and type, without initializing entries.

Since the code is zipped in gluoncv-0.3.0-py3.6.egg, I can’t directly print internal variable.
So I really want execute code line-by-line. Anyone knows how to do it? Thanks


Hi @JWarlock,

So you’re trying to set a breakpoint here to confirm? If so, this should work fine and you should be able to inspect and print the internal variables no problem. Assuming you haven’t already hybridized your network that is.

You might have accidentally set an extra breakpoint, or you could have a mismatch between the code you’re setting breakpoints in and actually running (especially watch out for this is you’re remote debugging). Are you using an IDE for debugging? Another way to break is by using import pdb; pdb.set_trace() above the line you’re wanting to break on.