Inspecting PyObject* content in autograd

(Maziar) #1


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?


(Maziar) #2

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