Fixed swapped dimensions and input arguments.