<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def dup_idx(arr):
 """Return the indices of all duplicated array elements. Parameters arr : array-like object An array-like object Returns ------- idx : NumPy array An array containing the indices of the duplicated elements Examples -------- array([], dtype=int64) array([4, 5]) array([0, 4, 5, 6]) """

    _, b = np.unique(arr, return_inverse=True)
    return np.nonzero(np.logical_or.reduce(
        b[:, np.newaxis] == np.nonzero(np.bincount(b) > 1),
        axis=1))[0]