Reputation: 95
i use tensorflow 2.1.0 and keras 2.2.4tf when I want to compile my model[here is the piece of code I use]:
model.compile(loss='binary_crossentropy',
optimizer=optimizers.RMSprop(lr=2e-5),
metrics=['acc'])
it gives this error :
NameError Traceback (most recent call last)
<ipython-input-11-09848482494e> in <module>
30
31 model.compile(loss='binary_crossentropy',
---> 32 optimizer=optimizers.RMSprop(lr=2e-5),
33 metrics=['acc'])
34
NameError: name 'optimizers' is not defined
but, I do not know what is the problem. if you may help me.
Upvotes: 3
Views: 7974
Reputation: 6367
Try calling:
model.compile(loss='binary_crossentropy',
optimizer=tf.keras.optimizers.RMSprop(lr=2e-5),
metrics=['acc'])
Upvotes: 8