(a)
| 3873 | nkeep = len(keep) |
| 3874 | |
| 3875 | def reshape_arr(a): |
| 3876 | # move axis that should not be reduced to front |
| 3877 | a = np.moveaxis(a, keep, range(nkeep)) |
| 3878 | # merge reduced axis |
| 3879 | return a.reshape(a.shape[:nkeep] + (-1,)) |
| 3880 | |
| 3881 | a = reshape_arr(a) |
| 3882 |