Finished the AutoEncoder cost function