Fix runtime errors in vbgan.py#1
Open
lxt3 wants to merge 3 commits into
Open
Conversation
pass in empty list to parse_args()
Update vbgan.py
…ent computation has been modified by an inplace operation: [torch.cuda.FloatTensor [128]] is at version 3; expected version 2 instead 1. Separate forward passes for the encoder and decoder updates 2. Freeze encoder and use x.detach() for decoder pass: After stepping the encoder, its batch-norm statistics are updated. By freezing encoder parameters, detaching the input, and recomputing the forward pass, the decoder receives a fresh computation graph that ignores the encoder’s updated state. This avoids the “in-place modification” runtime error. 3. No retain_graph: Because each backward now uses its own fresh forward pass, the graph is rebuilt every time. No shared graph means no need to retain it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed fix for: RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.cuda.FloatTensor [128]] is at version 3; expected version 2 instead
Also, pass in empty list to parse_args(): args = parser.parse_args([])