Hi Sebastian,

On Wed, Jun 30, 2021, at 18:23, Sebastian Berg wrote:
> The PR https://github.com/numpy/numpy/pull/19211 proposes to extend
> argmin and argmax with a `keepdims=False` keyword-only argument.

This seems consistent with existing APIs, so I'm not concerned.

For those wondering, `keepdims` preserves the number of dimensions of the 
original array in a reduction operation like `sum`:

In [1]: X = np.random.random((10, 15))

In [2]: np.sum(X).shape
Out[2]: ()

In [3]: np.sum(X, keepdims=True).shape
Out[3]: (1, 1)

This is sometimes useful for broadcasting.

> The PR  also proposes to add:
> 
> * `PyArray_ArgMinWithKeepdims`
> * `PyArray_ArgMaxWithKeepdims`

I am curious whether this is our general pattern for adding keyword argument 
functionality to functions in the C-API.  It seems a bit excessive!

Stéfan
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion

Reply via email to