Inspecting PyObject* content in autograd


I am trying to read the values in “tensors” and “grad_tensors” in “python_engine.cpp” using gdb.

  • When I print tensors it shows that they are of type PyObject*.
  • When I print *tensors it shows the refcount and ob_type.

I can inspect tensors->ob_type->* further but I cannot see the contents (values) of tensors or grad_tensors. Is this possible? If yes then how?


Yeah, to answer that question, basically watch at all these great videos here: Philip Guo - CPython Internals