以下是一个简单的用于CIFAR-10数据集的Python代码,它使用TensorFlow框架:
import tensorflow as tf
from tensorflow import keras
from tensorflow.keras import layers
# 加载数据集
(x_train, y_train), (x_test, y_test) = keras.datasets.cifar10.load_data()
# 数据预处理
x_train = x_train.astype("float32") / 255.0
x_test = x_test.