An autoencoder is an interesting unsupervised learning algorithm. Unlike other neural networks, the objective of the autoencoder is to reconstruct the given input; that is, the output of the autoencoders is the same as the input. It consists of two important components called the encoder and the decoder.
The role of the encoder is to encode the input by learning the latent representation of the input, and the role of the decoder is to reconstruct the input from the latent representation produced by the encoder. The latent representation is also called bottleneck or code. As shown in the following diagram, an image is passed as an input to the autoencoder. An encoder takes the image and learns the latent representation of the image. The decoder takes the latent representation and tries to reconstruct the image:
A simple vanilla autoencoder with two layers...