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

5-jsma-pytorch.ipynb代码在cuda上运行代码修改 #12

Open
igeng opened this issue Sep 1, 2020 · 0 comments
Open

5-jsma-pytorch.ipynb代码在cuda上运行代码修改 #12

igeng opened this issue Sep 1, 2020 · 0 comments

Comments

@igeng
Copy link

igeng commented Sep 1, 2020

兜哥您好,我在复现您的code/5-jsma-pytorch.ipynb代码时候,发现循环训练中最后一行
img.data[idx]=np.clip(img.data[idx], min_, max_)
该行代码在cuda上运行需要修改,img在cuda上运行的时候,因为img是cuda tensor,需要转化为cpu tensor,再进行numpy运算。
img.data[idx]=np.clip(img.data[idx].cpu(), min_, max_)

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

1 participant