np.unique with return_inverse and axis optimization guide as expected in multi-dimensional array
I'm trying to use `np.unique` with the `return_inverse` parameter on a 2D NumPy array, but I'm getting unexpected results. My objective is to find the unique rows in my array and retrieve the indices of the unique rows that correspond to each original row. However, it seems like the `return_inverse` is not behaving as I anticipated. Here's the code I'm working with: ```python import numpy as np array = np.array([[1, 2], [3, 4], [1, 2], [5, 6], [3, 4]]) unique_rows, inverse_indices = np.unique(array, return_inverse=True, axis=0) print("Unique Rows:", unique_rows) print("Inverse Indices:", inverse_indices) ``` I'm expecting `unique_rows` to contain the unique rows from the original array, which it does. However, the `inverse_indices` output does not seem to match the expected indices correctly. For instance, I thought that the first occurrence of `[1, 2]` would have an index of `0`, but it looks like it's returning a different mapping altogether. I'm using NumPy version 1.21.0 and running this in a Python 3.8 environment. Is there something I'm missing here? Could this be related to how `np.unique` handles multi-dimensional arrays for the `return_inverse` functionality? Any insights would be greatly appreciated!