Get device_id of the given cuda.FloatTensor?

device_id = 1
v = Variable(torch.rand(3, 4)).cuda(device_id)

Is there an API that returns the device_id, i.e. 1, of a cuda variable?

use get_device

v.get_device()
3 Likes