def take_2d_multi(arr, indexer, out=None, fill_value=np.nan, mask_info=None,<EOL>allow_fill=True):
if indexer is None or (indexer[<NUM_LIT:0>] is None and indexer[<NUM_LIT:1>] is None):<EOL><INDENT>row_idx = np.arange(arr.shape[<NUM_LIT:0>], dtype=np.int64)<EOL>col_idx = np.arange(arr.shape[<NUM_LIT:1>], dtype=np.int64)<EOL>indexer = row_idx, col_idx<EOL>dtype, fill_value = arr.dtype, arr.dtype.type()<EOL><DEDENT>else:<EOL><INDENT>row_idx, col_idx = indexer<EOL>if row_idx is None:<EOL><INDENT>row_idx = np.arange(arr.shape[<NUM_LIT:0>], dtype=np.int64)<EOL><DEDENT>else:<EOL><INDENT>row_idx = ensure_int64(row_idx)<EOL><DEDENT>if col_idx is None:<EOL><INDENT>col_idx = np.arange(arr.shape[<NUM_LIT:1>], dtype=np.int64)<EOL><DEDENT>else:<EOL><INDENT>col_idx = ensure_int64(col_idx)<EOL><DEDENT>indexer = row_idx, col_idx<EOL>if not allow_fill:<EOL><INDENT>dtype, fill_value = arr.dtype, arr.dtype.type()<EOL>mask_info = None, False<EOL><DEDENT>else:<EOL><INDENT>dtype, fill_value = maybe_promote(arr.dtype, fill_value)<EOL>if dtype != arr.dtype and (out is None or out.dtype != dtype):<EOL><INDENT>if mask_info is not None:<EOL><INDENT>(row_mask, col_mask), (row_needs, col_needs) = mask_info<EOL><DEDENT>else:<EOL><INDENT>row_mask = row_idx == -<NUM_LIT:1><EOL>col_mask = col_idx == -<NUM_LIT:1><EOL>row_needs = row_mask.any()<EOL>col_needs = col_mask.any()<EOL>mask_info = (row_mask, col_mask), (row_needs, col_needs)<EOL><DEDENT>if row_needs or col_needs:<EOL><INDENT>if out is not None and out.dtype != dtype:<EOL><INDENT>raise TypeError('<STR_LIT>')<EOL><DEDENT><DEDENT>else:<EOL><INDENT>dtype, fill_value = arr.dtype, arr.dtype.type()<EOL><DEDENT><DEDENT><DEDENT><DEDENT>if out is None:<EOL><INDENT>out_shape = len(row_idx), len(col_idx)<EOL>out = np.empty(out_shape, dtype=dtype)<EOL><DEDENT>func = _take_2d_multi_dict.get((arr.dtype.name, out.dtype.name), None)<EOL>if func is None and arr.dtype != out.dtype:<EOL><INDENT>func = _take_2d_multi_dict.get((out.dtype.name, out.dtype.name), None)<EOL>if func is not None:<EOL><INDENT>func = _convert_wrapper(func, out.dtype)<EOL><DEDENT><DEDENT>if func is None:<EOL><INDENT>def func(arr, indexer, out, fill_value=np.nan):<EOL><INDENT>_take_2d_multi_object(arr, indexer, out, fill_value=fill_value,<EOL>mask_info=mask_info)<EOL><DEDENT><DEDENT>func(arr, indexer, out=out, fill_value=fill_value)<EOL>return out<EOL>
Specialized Cython take which sets NaN values in one pass