“Could not interpret optimizer identifier” error in Keras

后端 未结 14 1708
别跟我提以往
别跟我提以往 2021-02-03 19:47

I got this error when I tried to modify the learning rate parameter of SGD optimizer in Keras. Did I miss something in my codes or my Keras was not installed properly?

14条回答
  •  星月不相逢
    2021-02-03 19:58

    Running the Keras documentaion example https://keras.io/examples/cifar10_cnn/ and installing the latest keras and tensor flow versions

    (at the time of this writing tensorflow 2.0.0a0 and Keras version 2.2.4 )

    I had to import explicitly the optimizer the keras the example is using,specifically the line on top of the example :

    opt = tensorflow.keras.optimizers.rmsprop(lr=0.0001, decay=1e-6)
    

    was replaced by

    from tensorflow.keras.optimizers import RMSprop
    
    opt = RMSprop(lr=0.0001, decay=1e-6)
    

    In the recent version the api "broke" and keras.stuff in a lot of cases became tensorflow.keras.stuff.

提交回复
热议问题