#报错记录#RuntimeError: Expected all tensors to be on the same device, but found at least two devices, cuda:0 and cpu!

有numpy和torch两种类型的数据

z = mean.clone().detach() + eps * torch.exp(logstd)

  源代码这边报错了,修改如下

eps = eps.cuda()    
z = mean.cuda()+ eps * torch.exp(logstd).cuda()

  就是把和numpy有关的,比如reshape什么的后面加上cuda()

posted @ 2021-11-08 09:49  tanyayangyang  阅读(2074)  评论(0)    收藏  举报