Comments (2)
That's strange. I'm using Python 3.6.3 and it's working fine for me. What 3.x.x version are you using?
Not sure if this will work (since it's also unpacking a list) but you could try:
class Discriminator(nn.Module):
def __init__(self, in_channels=3):
super(Discriminator, self).__init__()
def discriminator_block(in_filters, out_filters, stride, normalize):
"""Returns layers of each discriminator block"""
layers = [nn.Conv2d(in_filters, out_filters, 3, stride, 1)]
if normalize:
layers.append(nn.InstanceNorm2d(out_filters))
layers.append(nn.LeakyReLU(0.2, inplace=True))
return layers
layers = []
layers.extend(discriminator_block(in_channels, 64, 2, False))
layers.extend(discriminator_block(64, 128, 2, True))
layers.extend(discriminator_block(128, 256, 2, True))
layers.extend(discriminator_block(256, 512 , 2, True))
layers.append(nn.Conv2d(512, 1, 3, 1, 1))
self.model = nn.Sequential(*layers)
def forward(self, img):
return self.model(img)
If not you might have to add the layers one by one.
Edit: Fixed typo
from pytorch-gan.
works like a charm. Two small issues
(i) There is a typo in the above code. Instead of "in_cannels" it should be "in_channels"
(ii) As you are using stride=2 for 4 times so I think line#54 in "cyclegan.py" needs to be changed as
patch_h, patch_w = int(opt.img_height / 2**4), int(opt.img_width / 2**4)
By the way, just wanted to confirm, the code also works for python2.7 too (with a few simple edits). I will try to run an experiment to see if the results also make sense with python2.7 😄
Thanks again
from pytorch-gan.
Related Issues (20)
- plot gradient norm and weight clipping for each layer
- Gradient of a Discriminator in optimizing a Generator HOT 3
- when to save model for inference
- AAE in data augmentation
- buffer in the cyclegan HOT 1
- how test image on original size? (UNIT)
- Can I specify the number of images to be generated? HOT 1
- Query: DCGAN Saving Weights AND Parallelization
- Question about error for context encoder HOT 1
- Query: WGAN-GP FID SCORE (PyTorch) HOT 2
- Cannot download facades dataset for Pix2Pix HOT 4
- A little mistake in acgan HOT 1
- ESRGAN results HOT 2
- Quote GAN HOT 1
- clip_value in WGANGP not used
- ESRGAN datasets.py problem
- 我长期研究和改进GAN,如果对GAN或者深度学习感兴趣的可以联系我,联系方式,wechat: lovedaixiaobaby HOT 2
- Dataset Download Link was changed HOT 1
- Is it possible for the AI (GAN Generative Adversarial Network) to generate exploit codes (in this first version only python) automatically? SueGAN HOT 1
- How to draw the architecture diagram ?
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 pytorch-gan.