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

Some points predicted by a net can't be backward using gpu. #59

Open
ludysama opened this issue Mar 6, 2023 · 2 comments
Open

Some points predicted by a net can't be backward using gpu. #59

ludysama opened this issue Mar 6, 2023 · 2 comments

Comments

@ludysama
Copy link

ludysama commented Mar 6, 2023

Hello, I encountered a problem while using diffvg. I used a ResNet18 network added with a 3-layer MLP network to predict the control point coordinates of a path, which was rendered by diffvg to obtain the img tensor, then I use it calculate a L1 loss with my target. However, during the loss backpropagation, cuda report an error of device error, seems like some tensor needed was not sent to gpu , but if I transfer the control point coordinates to cpu, diffvg will use all tensors on cpu during rendering without this problem.

I looked through the examples in /app, I also found that some examples (GAN) also calculate loss with tensor from cpu. I’m not sure if this operation can be done on gpu?

@MADONOKOUKI
Copy link

I have the same issues too. (CPU works but GPU does not work). Or we will have illegal memory access error

@ludysama
Copy link
Author

I try to sovle this problem by initing Path with the value that net predicted, then let gpu just optimize the path's point tensor, then let it backward first, after it just using a L1 loss to let net's pred logits close to optimized path's point.
It was really boring to do. I faced with many bugs, and have'n done it. >.<

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

2 participants