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

numpy 1.12.0rc2 compatibility fix related to variable typecasting #5406

Merged
merged 2 commits into from Jan 16, 2017

Conversation

chinnadhurai
Copy link
Contributor

@chinnadhurai chinnadhurai commented Jan 13, 2017

Fix for 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".

related to 5396

@@ -116,6 +117,11 @@ def make_node(self, n, p, shape):
n = tensor.as_tensor_variable(n)
p = tensor.as_tensor_variable(p)
shape = tensor.as_tensor_variable(shape)

assert n.dtype in discrete_dtypes
assert p.dtype not in discrete_dtypes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p is a probability, shouldn't it be a float?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah..so, change "assert p.dtype not in discrete_dtypes" to "assert p.dtype in float_dtypes" ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's try that, it will avoid user errors.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, committed the changes.. also confirmed that the nosetests still pass

@slefrancois
Copy link
Collaborator

jenkins test this

@slefrancois
Copy link
Collaborator

jenkins test this

@slefrancois
Copy link
Collaborator

@nouiz , looks good to me once jenkins passes, can you double-check?

@nouiz
Copy link
Member

nouiz commented Jan 16, 2017

ok for me too.

@nouiz nouiz merged commit e8e01f4 into Theano:master Jan 16, 2017
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.

None yet

3 participants