Comments (4)
Hi,
The code should work fine. There might some difference with respect to the python version or similar to that. The error you are getting is not an uncommon error, did you tried to google it. I think modifying the version should work.
from vae-gan.
It's rather common error, i found it in several VAE-GAN models.
from vae-gan.
Hi,
The code should work fine. There might some difference with respect to the python version or similar to that. The error you are getting is not an uncommon error, did you tried to google it. I think modifying the version should work.
Could you please provide your environment, i.e., the requirements of this repo code?
from vae-gan.
Hi,
The code should work fine. There might some difference with respect to the python version or similar to that. The error you are getting is not an uncommon error, did you tried to google it. I think modifying the version should work.
I encountered the same problem, my environment is pytorch1.7+python3.9. I guess this is because in the newer version of pytorch, .step() directly changes the parameters in the graph, instead of creating a clone like in the old version. So I tried to put all optimizer.step() after all loss.backward() was completed.
`net.zero_grad()
# encoder
loss_encoder.backward(retain_graph=True) #someone likes to clamp the grad here: [p.grad.data.clamp_(-1,1) for p in net.encoder.parameters()]
net.decoder.zero_grad()
net.discriminator.zero_grad()
if (train_dec and train_dis == True):
loss_decoder.backward(retain_graph=True)
net.discriminator.zero_grad()
loss_discriminator.backward()
optimizer_encoder.step()
optimizer_decoder.step()
optimizer_discriminator.step()
#decoder
if (train_dec == True and train_dis == False):
loss_decoder.backward() #[p.grad.data.clamp_(-1,1) for p in net.decoder.parameters()]
optimizer_decoder.step()
optimizer_encoder.step()
optimizer_discriminator.step()
#discriminator
if (train_dec == False and train_dis == True):
loss_discriminator.backward()
optimizer_encoder.step()
optimizer_decoder.step()
optimizer_discriminator.step()
if (train_dec == False and train_dis == False):
optimizer_encoder.step()`
from vae-gan.
Related Issues (5)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vae-gan.