new function: broadcast_shapes

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

new function: broadcast_shapes

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
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: new function: broadcast_shapes

Warren Weckesser-2
On 10/15/20, Madhulika Jain Chambers <[hidden email]> 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
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: new function: broadcast_shapes

Stephan Hoyer-2
On Thu, Oct 15, 2020 at 11:46 AM Warren Weckesser <[hidden email]> wrote:
On 10/15/20, Madhulika Jain Chambers <[hidden email]> 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:

_______________________________________________
NumPy-Discussion mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion
Reply | Threaded
Open this post in threaded view
|

Re: new function: broadcast_shapes

bashtage
There is at least one custom implementation in `Generator` IIRC, so a formal API addition sounds like a good idea. 

Kevin


On Thu, Oct 15, 2020 at 8:52 PM Stephan Hoyer <[hidden email]> wrote:
On Thu, Oct 15, 2020 at 11:46 AM Warren Weckesser <[hidden email]> wrote:
On 10/15/20, Madhulika Jain Chambers <[hidden email]> 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:
_______________________________________________
NumPy-Discussion mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion

_______________________________________________
NumPy-Discussion mailing list
[hidden email]
https://mail.python.org/mailman/listinfo/numpy-discussion