[Numpy-discussion] Add a function to broadcast arrays to a given shape to numpy's stride_tricks?
shoyer at gmail.com
Thu Dec 11 01:39:04 EST 2014
On Wed, Dec 10, 2014 at 4:00 PM, Nathaniel Smith <njs at pobox.com> wrote:
> 2) Add a broadcast_to(arr, shape) function, which broadcasts the array
> to exactly the shape given, or else errors out if this is not
I like np.broadcast_to as a new function. We can document it alongside
broadcast and broadcast_arrays under array manipulation routines, which
would make it at least as discoverable as the standard broadcasting
I'm not opposed to adding extra_shapes as a keyword argument to
broadcast_arrays, but it seems unnecessarily complex, Implementation wise,
I think it would actual make more sense to make broadcast_arrays depend on
broadcast_to (e.g., by composing a function to calculate the broadcast
shape with broadcast_to).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion