Debugger question about tensor


I started using spyder and a debugger not long ago.
Essentially, I just want to have the effect of print(tensor) without having to write print(tensor) everywhere in my code.

So I take a look inside the variable explorer:
while I can peek inside a dataframe just fine (the “value” column coincides with what I’d get if I were to print(dataframe)). In the case of pytorch tensor however, the variable explorer shows a tensor object alongside all its built-in methods, I’m not too sure how I can peek inside of it.

What am I doing wrong? If I’m not looking at the right IDE, is there any other IDE that would allow me to do so?


There is an open feature request for Spyder wich a posted workaround in case you are comfortable changing the spyder internals.

1 Like

pycharm can auto-peek, but for GPU tensors this lags pretty badly (because of cross-device data transfers, I don’t blame IDE here), so pycharm’s on demand variable loading mode is arguably better - it loads data on a mouse click

1 Like