Skip to content

BUG: handle length-0 axes correctly in ufunc.reduce without identity - #323

Merged
njsmith merged 1 commit into
numpy:masterfrom
njsmith:zero-size-reductions
Jul 6, 2012
Merged

njsmith merged 1 commit into
numpy:masterfrom
njsmith:zero-size-reductions

Conversation

@njsmith

@njsmith njsmith commented Jun 27, 2012

Copy link
Copy Markdown
Member

In numpy 1.6, reduction operations with no identity
(e.g. numpy.maximum) gave an error iff they were asked to reduce a
0-element dimension. This regressed during the 1.7 development cycle,
so that they started giving an error if any dimension had 0
elements, even ones that were not reduced over. Fixes bug #2078.

In numpy 1.6, reduction operations with no identity
(e.g. numpy.maximum) gave an error iff they were asked to reduce a
0-element dimension. This regressed during the 1.7 development cycle,
so that they started giving an error if *any* dimension had 0
elements, even ones that were not reduced over. Fixes bug numpy#2078.
@travisbot

Copy link
Copy Markdown

This pull request fails (merged 15738e1 into e15d0bd).

@njsmith

njsmith commented Jun 27, 2012

Copy link
Copy Markdown
Member Author

WTF? The one failure reported by Travis-CI is with Python 2.5, it's a test unrelated to this change, and I can't reproduce it here.

The failing test is:

  a = np.arange(5)
  a[:3] = a[2:]
  assert_equal(a, [2, 3, 4, 3, 4])

and what we're getting for a is [4, 3, 4, 3, 4], which is what you'd expect if the assignments were performed in backwards order (a[2] = a[4], a[1] = a[3], a[0] = a[2]).

I suspect that what this is saying is that numpy is in fact buggy in how it handles these assignments, but that this test has mostly been accidentally passing by chance.

@njsmith

njsmith commented Jun 27, 2012

Copy link
Copy Markdown
Member Author

@stefanv

stefanv commented Jul 1, 2012

Copy link
Copy Markdown
Contributor

Looks good to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants