Clone from https://github.com/sdemyanov/ConvNet