![](https://secure.gravatar.com/avatar/96dd777e397ab128fedab46af97a3a4a.jpg?s=120&d=mm&r=g)
On Mon, Sep 24, 2012 at 2:25 PM, Frédéric Bastien <nouiz@nouiz.org> wrote:
Hi,
I tested this new beta on Theano and discovered an interface change that was not there in the beta 1.
New behavior: numpy.ndindex().next() (0,)
Old behavior: numpy.ndindex().next() ()
This break some Theano code that look like this:
import numpy shape=() out_shape=[12] random_state=numpy.random.RandomState()
out = numpy.zeros(out_shape, int) for i in numpy.ndindex(*shape): out[i] = random_state.permutation(5)
I suppose this is an regression as the only mention of ndindex in the first email of this change is that it is faster.
I think this problem has been brought up on the list. It is interesting that it turned up after the first beta. Could you do a bisection to discover which commit is responsible?
There is a second "regression" in ndindex This was working in the past, but it raise an ValueError now:
numpy.ndindex((2,1,1,1))
But If I call numpy.ndindex(2,1,1,1)
The documentation[1] do not talk about receiving a tuple as input. I already make a commit to change Theano code to make it work. But this could break other people code. It is up to you to decide if you want this, but a warning in the release note would be great to help people know that the old not documented behavior changed.
Do you know if the first change is expected? This will probably cause bad results in some people code if you intended this change.
Chuck