bstriner / keras-adversarial

Keras Generative Adversarial Networks
MIT License
867 stars 231 forks source link

problem with example_gan_cifar10.py #32

Closed infiniteperplexity closed 7 years ago

infiniteperplexity commented 7 years ago

I get the following error when I try to run the code:

main() Traceback (most recent call last):

File "", line 1, in main()

File "", line 137, in main generator = model_generator()

File "", line 33, in model_generator model.add(Convolution2D(nch / 2, h, h, border_mode='same', W_regularizer=reg()))

File "C:\Users\M543015\AppData\Local\Continuum\Anaconda3\lib\site-packages\keras\models.py", line 476, in add output_tensor = layer(self.outputs[0])

File "C:\Users\M543015\AppData\Local\Continuum\Anaconda3\lib\site-packages\keras\engine\topology.py", line 569, in call self.build(input_shapes[0])

File "C:\Users\M543015\AppData\Local\Continuum\Anaconda3\lib\site-packages\keras\layers\convolutional.py", line 134, in build constraint=self.kernel_constraint)

File "C:\Users\M543015\AppData\Local\Continuum\Anaconda3\lib\site-packages\keras\legacy\interfaces.py", line 88, in wrapper return func(*args, **kwargs)

File "C:\Users\M543015\AppData\Local\Continuum\Anaconda3\lib\site-packages\keras\engine\topology.py", line 391, in add_weight weight = K.variable(initializer(shape), dtype=dtype, name=name)

File "C:\Users\M543015\AppData\Local\Continuum\Anaconda3\lib\site-packages\keras\initializers.py", line 208, in call dtype=dtype, seed=self.seed)

File "C:\Users\M543015\AppData\Local\Continuum\Anaconda3\lib\site-packages\keras\backend\theano_backend.py", line 2123, in random_uniform return rng.uniform(shape, low=minval, high=maxval, dtype=dtype)

File "C:\Users\M543015\AppData\Local\Continuum\Anaconda3\lib\site-packages\theano\sandbox\rng_mrg.py", line 1339, in uniform for i in size]), msg

AssertionError: size must be a tuple of int or a Theano variable

Is this an issue somehow related to versioning, or to choice of backend?

bstriner commented 7 years ago

Need to wrap with int() for python 3 compatibility. python 2 int division results in an int. Similar fixes need to be made to the other examples.

Just merged the changes so you should just be able to pull. Thank @isaacmg for the fix. https://github.com/bstriner/keras-adversarial/pull/30

Cheers

infiniteperplexity commented 7 years ago

Great, thanks!

Sent from my iPhone

On Jun 27, 2017, at 11:09 PM, Ben notifications@github.com wrote:

Need to wrap with int() for python 3 compatibility. python 2 int division results in an int. Similar fixes need to be made to the other examples.

Just merged the changes so you should just be able to pull. Thank @isaacmg for the fix. #30

Cheers

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.