Implement mini-batch learning.

Use distinct Layer type for each RBM, cover some functions by tests.