Open MaxforCherubim opened 7 months ago
The trick can not work:
def demean_axis(arr, axis): means = arr.mean(axis) indexer = [slice(None)] * arr.ndim indexer[axis] = np.newaxis return arr - means[indexer]
Here is the way to figue out:
def demean_axis(arr, axis): means = arr.mean(axis) indexer = [slice(None)] * arr.ndim indexer[axis] = np.newaxis return arr - means[*indexer]
The trick can not work:
Here is the way to figue out: