简体   繁体   中英

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, ie, 0.94091?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM