[Numpy-discussion] new function: broadcast_shapes

2020-10-15 Thread Madhulika Jain Chambers
Hello all,

I opened a PR to add a function which returns the broadcasted shape from a
given set of shapes:
https://github.com/numpy/numpy/pull/17535

As this is a proposed change to the API, I wanted to see if there was any
feedback from the list.

Thanks so much,

Madhulika
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] new function: broadcast_shapes

2020-10-15 Thread Warren Weckesser
On 10/15/20, Madhulika Jain Chambers  wrote:
> Hello all,
>
> I opened a PR to add a function which returns the broadcasted shape from a
> given set of shapes:
> https://github.com/numpy/numpy/pull/17535
>
> As this is a proposed change to the API, I wanted to see if there was any
> feedback from the list.


Thanks, this is useful!  I've implemented something similar many times
over the years, and could have used it in some SciPy code, where we
currently have a private implementation in one of the `stats` modules.

Warren


>
> Thanks so much,
>
> Madhulika
>
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


Re: [Numpy-discussion] new function: broadcast_shapes

2020-10-15 Thread Stephan Hoyer
On Thu, Oct 15, 2020 at 11:46 AM Warren Weckesser <
warren.weckes...@gmail.com> wrote:

> On 10/15/20, Madhulika Jain Chambers  wrote:
> > Hello all,
> >
> > I opened a PR to add a function which returns the broadcasted shape from
> a
> > given set of shapes:
> > https://github.com/numpy/numpy/pull/17535
> >
> > As this is a proposed change to the API, I wanted to see if there was any
> > feedback from the list.
>
>
> Thanks, this is useful!  I've implemented something similar many times
> over the years, and could have used it in some SciPy code, where we
> currently have a private implementation in one of the `stats` modules.
>
> Warren


+1 for adding this.

There's a version of this helper function -- coincidentally with the
exactly same API and name -- in JAX, too:
https://github.com/google/jax/blob/22c3684d3bac3ad0f40aca69cdbc76842fa9dfc0/jax/lax/lax.py#L73
___
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion