assert same number of dimensions and channels in batch as in training

... in order to fix #401