(a)
| 2140 | |
| 2141 | @derived_from(np) |
| 2142 | def argwhere(a): |
| 2143 | a = asarray(a) |
| 2144 | |
| 2145 | nz = isnonzero(a).flatten() |
| 2146 | |
| 2147 | ind = indices(a.shape, dtype=np.intp, chunks=a.chunks) |
| 2148 | if ind.ndim > 1: |
| 2149 | ind = stack([ind[i].ravel() for i in range(len(ind))], axis=1) |
| 2150 | ind = compress(nz, ind, axis=0) |
| 2151 | |
| 2152 | return ind |
| 2153 | |
| 2154 | |
| 2155 | @derived_from(np) |