当导入:from keras.utils import to_categorical时
会报错:ImportError: cannot import name 'to_categorical'
这是因为该方法被迁移到了tensorflow中,
可以改为: from tensorflow.keras.utils import to_categorical
版权声明:本文为fu_jian_ping原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。
当导入:from keras.utils import to_categorical时
会报错:ImportError: cannot import name 'to_categorical'
这是因为该方法被迁移到了tensorflow中,
可以改为: from tensorflow.keras.utils import to_categorical