AutoEncoder: Fixed incorrect reshaping (it's different than in Matlab)

- added a small test