I’m curious why the .cuda is necessary in this line of code when targs is on the gpu?

ts = targs[::self.ns].type(torch.FloatTensor).cuda()-1.

without the .cuda I get an error about a cpu backend.  Does casting really move a tensor, and what’s the reasoning behind that?
Also I’m hoping behind the scenes this is being kept on gpu?