Building the contractive autoencoder is just as same as building the autoencoder, except that we use the contractive loss regularizer in the model, so instead of looking at the whole code, we will only look at the parts related to implementing the contractive loss.