Does data = batch['data'].cuda().function().cpu() make sense?
I have a dataset, which I call with batch['data'] and get my image output MxM. After I get my image I want to process it with some numpy operations. In this process I want my dataset to give me the image with GPU and changing the outputs device to CPU after that.
My question is, is concetanation of functions in Python being executed in an order? And can I make this process with
base = batch['data'].cuda().function().cpu() 

And is this the same as:
base = batch['data'].cuda().function()
base.cpu()

Thanks in advance!

Well, the CPU(s) will do the same work, but the result is not the same.

base = batch['data'].cuda().cpu() 


After that line, you have the output of cpu() stored in the variable called base.

base = batch['data'].cuda()
base.cpu()


After these two lines, you have the output of cuda() stored in the variable called base and you have forgotten the result of cpu().
