Visual studio debugger can't watch tensor value in .0.4.0 but in 0.3.1 we can

does anyone encounter a similar situation.

watch window:
in 0.3.1, we can see the data values
1
but in 0.4.0, we only can’t watch the value of the Tensor,we can only watch the shape and other things.

in .4.0
2

with other tools,such as vs coder,spyder, We obtain the same results.

Can anybody help me?

If I understand 0.4 correctly, new tensors contain a list of 1-element tensors:

>>>list(torch.zeros(5))
[tensor(0.), tensor(0.), tensor(0.), tensor(0.), tensor(0.)]

What you can do in emergency is to create a numpy array using ‘Tensor.numpy’ in order to visualize its content in Vstudio

Because it is now a C++ Tensor, not a raw value in python. Can you please tick C++ Native in the debug window and see if that helps.

thanks ,Alexis and peterjc123. With print function,I can see the tensor values. I am a little wondering why. 4.0 version gives up these convenience.

No, it’s not only about convenience. The most important thing is speed, right? It is the fact that the calculations are moved to ATen(C++) that makes it quicker.

Do you know how to do this in VS Code?