Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Theano support numpy 1.12 #5396

Closed
2 of 5 tasks
nouiz opened this issue Jan 10, 2017 · 13 comments
Closed
2 of 5 tasks

Make Theano support numpy 1.12 #5396

nouiz opened this issue Jan 10, 2017 · 13 comments

Comments

@nouiz
Copy link
Member

nouiz commented Jan 10, 2017

See: numpy/numpy#8420 (comment)

Many Theano tests are failing with numpy 1.12 rc.

In summary, there seem to be 4 types of errors:

  • TypeError: 'float' object cannot be interpreted as an index errors are from using floats to index arrays, it can probably be fixed in the test by making the dimensions in out_shp integer.
  • TypeError: Cannot cast array data from dtype('float32') to dtype('int64') according to the rule 'safe' can be fixed by making the cast explicit, casting="unsafe".
  • TypeError: invalid strides looks to be because of relaxed stride checking.
  • That leaves the arctanh errors and I don't know what is going on there.
  • TypeError: 'numpy.float64' object cannot be interpreted as an index
@gokul-uf
Copy link
Contributor

@nouiz I'd like to work on this if no one's assigned

@nouiz
Copy link
Member Author

nouiz commented Jan 11, 2017

Maybe someone was working on the first point. So start by the second and third point.

thanks.

@chinnadhurai
Copy link
Contributor

chinnadhurai commented Jan 12, 2017

I have been working on this as part of the CCW. With numpy version, 1.12.0rc2, I am able to reproduce issue 2. Issue 1 and 4 are not reproducible so far. So, I shall fix the errors for issue 2 for now I guess.

@gokul-uf
Copy link
Contributor

@chinnadhurai you could send a PR for the second issue alone. We could work on this together if you like :)

@chinnadhurai
Copy link
Contributor

chinnadhurai commented Jan 12, 2017

@slefrancois and I fixed issue 2 this morning. @gokul-uf, Would you be interested in working on issue 3?

@slefrancois
Copy link
Collaborator

I can't reproduce error 1, "float object cannot be interpreted as index".
Also, the arctanh error seems to be a problem with an old glibc.
So we recommend fixing only points 2-3 for now.

@gokul-uf
Copy link
Contributor

gokul-uf commented Jan 12, 2017

@chinnadhurai, yes, any ideas on why we are getting this error?

@slefrancois
Copy link
Collaborator

invalid strides relate to issue #1586

@slefrancois
Copy link
Collaborator

We're going to do a final test by forcing Travis to use numpy 1.12 before closing.

@chinnadhurai
Copy link
Contributor

chinnadhurai commented Jan 27, 2017

IMPORTANT NOTE : numpy 1.12.0 requires python version 3.4 or higher (issue #4507)

@rebecca-palmer
Copy link
Contributor

I can reproduce point 1 in Theano 0.8 (TypeError: 'float' object cannot be interpreted as an index), in test_bincountFn (theano.tensor.tests.test_extra_ops.TestBinCountOp) for the uint64 type (only), and can fix it with here

  •          size = data.max() + 1
    
  •          size = int(data.max()) + 1
    

I suspect this is because numpy uint64 scalar (i.e. data.max()) + Python int returns numpy float64 (not allowed as an index in numpy 1.12), while for the other integer types it returns the same integer types.

I'd expect this to also work in Theano master, but haven't tried this.

There's also another test failure with Numpy 1.12, which I have reported separately.

@slefrancois
Copy link
Collaborator

Another error related to taking ArgMax of a scalar and returning 0 for all scalars:
https://travis-ci.org/Theano/Theano/jobs/196714103#L3203

numpy.prod(size=()) produces 1.0, but reshape() would warn silently. From 1.12 onward, it became an error.

@lamblin
Copy link
Member

lamblin commented Feb 13, 2017

Fixed in #5527.

@lamblin lamblin closed this as completed Feb 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants