application_vnd.jupyter.stderr_output_9.png application_vnd.jupyter.stderr_output_7.png application_vnd.jupyter.stderr_output_11.png text_plain_output_20.png text_plain_output_4.png text_plain_output_14.png text_plain_output_10.png text_plain_output_6.png text_plain_output_18.png application_vnd.jupyter.stderr_output_19.png application_vnd.jupyter.stderr_output_13.png application_vnd.jupyter.stderr_output_3.png application_vnd.jupyter.stderr_output_5.png text_plain_output_16.png application_vnd.jupyter.stderr_output_15.png text_plain_output_8.png application_vnd.jupyter.stderr_output_17.png text_plain_output_2.png application_vnd.jupyter.stderr_output_1.png text_plain_output_12.png application_vnd.jupyter.stderr_output_21.png
from tensorflow.keras import Model, Sequential

from tensorflow.keras.datasets import cifar10

from tensorflow.keras.layers.experimental.preprocessing import RandomFlip, RandomRotation, RandomZoom, RandomTranslation

import tensorflow as tf

import tensorflow as tf
from tensorflow.keras.layers import Dense, Flatten, Conv2D, Concatenate, Add
from tensorflow.keras.layers.experimental.preprocessing import RandomFlip, RandomRotation, RandomZoom, RandomTranslation
from tensorflow.keras import Model, Sequential
from tensorflow.keras.losses import SparseCategoricalCrossentropy
from tensorflow.keras.optimizers import Adam, SGD
from tensorflow import GradientTape
from tensorflow.keras.metrics import SparseCategoricalAccuracy
from tensorflow.keras.datasets import cifar10
from tensorflow.keras.utils import plot_model
import matplotlib.pyplot as plt
import numpy as np
(x_train, y_train), (x_test, y_test) = cifar10.load_data()
x_train, x_test = (x_train / 255.0, x_test / 255.0)
data_augmentation = Sequential([RandomFlip('horizontal'), RandomTranslation(height_factor=(-0.1, 0.1), width_factor=(-0.1, 0.1), fill_mode='constant')])
train_ds = tf.data.Dataset.from_tensor_slices((x_train, y_train)).shuffle(10000).batch(32).map(lambda x, y: (data_augmentation(x), y))
test_ds = tf.data.Dataset.from_tensor_slices((x_test, y_test)).batch(32)