Added check NDim for same dtype.

Fixed key error.