[Numpy-discussion] np.dot and 'out' bug

Nathaniel Smith njs at pobox.com
Thu May 23 11:14:41 EDT 2013


On Thu, May 23, 2013 at 3:57 PM, Matthieu Brucher
<matthieu.brucher at gmail.com> wrote:
> In my point of view, you should never use an output argument equal to an
> input argument. It can impede a lot of optimizations.

This is a fine philosophy in some cases, but a non-starter in others.
Python doesn't have optimizations in the first place, and in-place
operations are often critical for managing memory usage. '+=' is an
important operator, and in numpy it's just 'np.add(a, b, out=a)' under
the hood.

On Thu, May 23, 2013 at 3:50 PM, Nicolas Rougier
<Nicolas.Rougier at inria.fr> wrote:
> Also, from a user point of view it is difficult to sort out which functions currently allow 'out=a' or  out=b' since nothing in the 'dot' documentation warned me about such problem.

That's because AFAIK all functions allow out=a and out=b, except for
those which contain bugs :-).

Can you file a bug in the bug tracker so this won't get lost?

-n



More information about the NumPy-Discussion mailing list