Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

module 'tensorflow.python.ops.nn' has no attribute 'leaky_relu' #13

Open
thiglu opened this issue Mar 26, 2018 · 1 comment
Open

module 'tensorflow.python.ops.nn' has no attribute 'leaky_relu' #13

thiglu opened this issue Mar 26, 2018 · 1 comment

Comments

@thiglu
Copy link

thiglu commented Mar 26, 2018

AttributeError Traceback (most recent call last)
in ()
190
191 if name == 'main':
--> 192 mnist_dcgan = MNIST_DCGAN()
193 timer = ElapsedTimer()
194 mnist_dcgan.train(train_steps=10000, batch_size=256, save_interval=500)

in init(self)
135
136 self.DCGAN = DCGAN()
--> 137 self.discriminator = self.DCGAN.discriminator_model()
138 self.adversarial = self.DCGAN.adversarial_model()
139 self.generator = self.DCGAN.generator()

in discriminator_model(self)
111 optimizer = RMSprop(lr=0.0002, decay=6e-8)
112 self.DM = Sequential()
--> 113 self.DM.add(self.discriminator())
114 self.DM.compile(loss='binary_crossentropy', optimizer=optimizer, metrics=['accuracy'])
115 return self.DM

in discriminator(self)
47 input_shape = (self.img_rows, self.img_cols, self.channel)
48 self.D.add(Conv2D(depth*1, 5, strides=2, input_shape=input_shape, padding='same'))
---> 49 self.D.add(LeakyReLU(alpha=0.2))
50 self.D.add(Dropout(dropout))
51

E:\Anaconda3\envs\python35\lib\site-packages\keras\models.py in add(self, layer)
490 output_shapes=[self.outputs[0]._keras_shape])
491 else:
--> 492 output_tensor = layer(self.outputs[0])
493 if isinstance(output_tensor, list):
494 raise TypeError('All layers in a Sequential model '

E:\Anaconda3\envs\python35\lib\site-packages\keras\engine\topology.py in call(self, inputs, **kwargs)
617
618 # Actually call the layer, collecting output(s), mask(s), and shape(s).
--> 619 output = self.call(inputs, **kwargs)
620 output_mask = self.compute_mask(inputs, previous_mask)
621

E:\Anaconda3\envs\python35\lib\site-packages\keras\layers\advanced_activations.py in call(self, inputs)
44
45 def call(self, inputs):
---> 46 return K.relu(inputs, alpha=self.alpha)
47
48 def get_config(self):

E:\Anaconda3\envs\python35\lib\site-packages\keras\backend\tensorflow_backend.py in relu(x, alpha, max_value)
2919 """
2920 if alpha != 0.:
-> 2921 x = tf.nn.leaky_relu(x, alpha)
2922 else:
2923 x = tf.nn.relu(x)

@moetmd
Copy link

moetmd commented May 8, 2018

change keras to 2.1.2 solved my problem.
you can use conda install keras=2.1.2 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants