Cast to ndarray.