Jetson nano freezes when training a Keras model

I am trying to train the Fashion MNIST dataset using a keras model in tensorflow in Jupyter notebook on Jetson nano. When I run the line to train the model, everything just freezes and the actual training doesn’t even start. Partial code is as below:

model = keras.Sequential([
keras.layers.Flatten(input_shape = (28, 28)),
keras.layers.Dense(128, activation = ‘relu’),
keras.layers.Dense(10, activation = ‘softmax’)
model.compile(optimizer = ‘adam’,
loss = ‘sparse_categorical_crossentropy’,
metrics = [‘accuracy’]), train_labels, epochs = 5)

Please check the following topic:
Most issues are triggered by insufficient RAM size. Please mount a swap file and try again.