Fix Numpy-related deprecation warnings
In several places of code, Numpy arrays are created from lists of arrays with mismatched shape. This is a deprecated behaviour and will be a failure in future. This MR aligns the shape, so that warnings are not emitted.
Part of this MR is a fixer for
master by @anton-akhmerov