During Gan’s training, we often encounter this problem: runtimeerror: trying to backward through the graph a second time, but the saved intermediate results have already been free
The description of this error is that when you are propagating in the direction, the cache is released in advance. Many solutions are to change loss. Backward() to loss. Backward (retain_graph = true). In fact, most of the code problems are not here, and the retention of the calculation chart may cause the cache to accumulate rapidly and lead to the explosion of the video memory, In fact, the real reason is that the discriminator and the producer share the same variables. Just add detach () when using variables for the first time.
#### Update Discriminator ### real_preds = netD(real_gt) fake_preds = netD(fake_coarse) #### Update Generator ##### real_preds = netD(real_gt) fake_preds = netD(fake_coarse)
#### Update Discriminator ### real_preds = netD(real_gt.detach()) fake_preds = netD(fake_coarse.detach()) #### Update Generator ##### real_preds = netD(real_gt) fake_preds = netD(fake_coarse)
It’s not easy to find the method. Thank you for your support
- [Solved] RuntimeError: CUDA error: out of memory
- [Solved] FFMPEG live encoding 2. session more error: [nvenc @ 0xa00480] OpenEncodeSessionEx failed: 0xa – invalid license key?
- TensorFlow tf.keras.losses .MeanSquaredError
- [Solved] ELK Log System Error: “statusCode“:429,“error“:“Too Many Requests“,“message“ Data too large
- ValueError: Input 0 of node import/save/Assign was passed float from import/beta1_power:0 incompatib
- Go Slice Error: panic:runtime error:index out of range  with length 0 [Solved]
- RuntimeError: CUDNN_STATUS_EXECUTION_FAILED [How to Solve]
- Cache penetration, cache breakdown and cache avalanche solutions
- Tensorflow Run Error or the interface is stuck or report error: Could not create cudnn handle: CUDNN_STATUS_INTERNAL_ERROR
- [Solved] volatile was removed and now has no effect. Use `with torch.no_grad():` instead.
- WordPress update failed 429 too many requests (How to Fix)
- Visual Studio 2012 error C4996: ‘scanf’: This function or variable may be unsafe.
- Rsync Error: Operation not permitted [How to Solve]
- Error during job, obtaining debugging information [How to Solve]
- Error using tensorflow GPU: could not create cudnn handle: cudnn_STATUS_NOT_INITIALIZED
- [Solved] Parcel Package Error: Cannot read property ‘length‘ of undefined
- How to Solve “Status bar could not find cached time string image. Rendering in-process.” in Xcode
- [Solved] Redis startup error Creating Server TCP listening socket 127.0.0.1:6379: bind: No error
- g++: internal compiler error: Killed (program cc1plus) Please submit a full bug report, with preprocess
- How to Fix win10 video dxgkrnl fatal error