from keras.utils import np_utils
y_train = np_utils.to_categorical(y_train, num_classes)
版本:keras 2.4.3 tensorflow 2.5.0
from keras.utils import np_utils
y_train = np_utils.to_categorical(y_train, num_classes)
版本:keras 2.4.3 tensorflow 2.5.0