Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

有大佬知道cuda:0 device type tensor to numpy怎么解决 #128

Open
xiaobai1feike opened this issue Feb 11, 2023 · 5 comments
Open

有大佬知道cuda:0 device type tensor to numpy怎么解决 #128

xiaobai1feike opened this issue Feb 11, 2023 · 5 comments

Comments

@xiaobai1feike
Copy link

can't convert cuda:0 device type tensor to numpy. Use Tensor.cpu() to copy the tensor to host memory first.

@zhunzhun123
Copy link

What exactly is the error

@MarkLi1214
Copy link

在tensor变量后面加.cpu()

@jibrilhp
Copy link

jibrilhp commented Jul 8, 2023

i changed it in lines 120-121 :

 # Compute loss at each stage
        loss_char =  torch.sum(torch.stack([criterion_char(restored[j], target) for j in range(len(restored))]))
        loss_edge = torch.sum(torch.stack([criterion_edge(restored[j], target) for j in range(len(restored))]))
        loss = (loss_char) + (0.05*loss_edge)

and it's worked

@6jybuchiyu
Copy link

i changed it in lines 120-121 :

 # Compute loss at each stage
        loss_char =  torch.sum(torch.stack([criterion_char(restored[j], target) for j in range(len(restored))]))
        loss_edge = torch.sum(torch.stack([criterion_edge(restored[j], target) for j in range(len(restored))]))
        loss = (loss_char) + (0.05*loss_edge)

and it's worked

It works! Thank you!

@Feecuin
Copy link

Feecuin commented Mar 31, 2024

请问下改了这里之后你们训练会遇到损失降不下来的情况吗?我PSNR一直上不去,后面训练的都不如前面的很低很低,这是什么情况呢?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants