处理 Runtime Error: one of the variables needed for gradient computation has been

Encountered this problem twice, record it

1. Backpropagation reports  an error. Refer to the blog of Runtime Error: one of the variables needed for gradient computation has been_qq_33093927 when using pytorch to generate an adversarial network-CSDN blog. Recently I was looking at GAN and encountered some problems. I found It is a pit stepped on by the predecessors, and it really helped me. Let’s focus on sorting out the directory problem, the environment configuration solution process, and the summary of the problem. modified by an inplace operation, specially record the pit row records. Environment configuration windows10 2004python 3.7.4pytorch 1 https://blog.csdn.net/qq_33093927/article/details/124063916?spm=1001.2101.3001.6650.5&utm_medium=distribute.pc_relevant.none-task-blog-BenddultFault%EBlog%7 7ERate-5-124063916-blog-125728708.pc_relevant_recovery_v2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7EBlogCommendFromBaidu%7ERate-5-124063916-blog-125728708.pc_relevant_recovery_v2&utm_relevant_index=6The core is to move the optimizer.step() to the back of the gradient calculation

2. The calculation error before backpropagation, refer to the third point in it

Pytorch reported an error: one of the variables needed for gradient computation has been modified by an inplace operation - lzp's bky - Blog Garden When using a model written by pytorch, an error was reported: RuntimeError: one of the variables needed for gradient computation has been modif https ://www.cnblogs.com/liangzp/p/9207979.html

Guess you like

Origin blog.csdn.net/weixin_42726476/article/details/128061840