Hello, i am doing someting wrong but i dont know what and i get this runtime error.

d_r = [T.sum(T.FloatTensor([self.gamma**i for i in range(r[j:].size(0))])
RuntimeError: expected device cpu but got device cuda:0

Codes is:

s = T.tensor(self.buffer['s'], dtype=T.double).to(self.device)
a = T.tensor(self.buffer['a'], dtype=T.double).to(self.device).view(-1, 1)
r = T.tensor(self.buffer['r'], dtype=T.double).to(self.device)
s_n = T.tensor(self.buffer['s_n'], dtype=T.double).to(self.device)
d = T.tensor(self.buffer['d'], dtype=T.double).to(self.device).view(-1, 1)

d_r = [T.sum(T.FloatTensor([self.gamma**i for i in range(r[j:].size(0))])\
             * r[j:]) for j in range(r.size(0))]

Can someone help me what i am doing wrong?