Learner
Learner

Reputation: 5

How to access the Tensor value?

I am very new to Pytorch. While finding the value of a variable, this is how it shows

tensor(0.94091, device='cuda:0')

How to access the number, i.e, 0.94091?

Upvotes: 0

Views: 158

Answers (1)

Milad Yousefi
Milad Yousefi

Reputation: 309

you can use .item() to get the value of size one tensor.

Upvotes: 1

Related Questions