Hi everyone,
There is my question, If I call a function which try to use Tensor.cpu() to make this Tensor can by change to Numpy after I have used Tensor.gpu(). And I won’t use the Tensor tackled in the function which is out of the main function.(The Tensor.gpu() is called in the main function). Will this operation change the Tensor in main function, which means the Tensor will be change to use cpu?So, the whole code may like this:
def change2cpu(x):
a = Tensor.cpu()
…
if name == ‘main’:
for bz_idx, x in enmerate(data):
…
a = Tensor.gpu()
…
change2cpu(a)