You should probably add an 'np.asarray' before, so that this works on lists.