-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Random slowdown clean #2296
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
Random slowdown clean #2296
Conversation
|
@hvasbath If this is identical I'd rather keep this one than the other one (despite what I said earlier). |
|
As you wish |
|
@twiecki should we set it to 3.2? We can have more time to test it. |
|
@junpenglao Good call. |
|
I don't think we should just cast values provided by a user to a different type. If users want to work with float32/int16 they should be required to cast their own values themselves. Otherwise this could lead to very nasty bugs. Say you're modelling counts of some kind, and some values don't fit in a int16. If we cast this silently, we end up with different values. The results will be wrong, and maybe only for a few values. This might be very hard to figure out or even notice. |
|
The point of this is that having theano tensors there is making the random method horribly slow. Having them as theano tensors there was to get GPU support running. Thats why we agreed to the casting to have both, the fast random and still right casting. Edit: There is the casting argument in numpy cast, which we should set to safe and it throws an error if the new datatype cannot express the number correctly ... |
|
Why would it be slow if we have a >>> a = np.array(127, dtype=np.int16)
>>> a + np.int8(1)
128
>>> a.astype(np.int8, casting='safe') + np.int8(1)
-128If users want this, they should cast themselves. (In which case it's their fault if it gives wrong answers). |
|
Then I suggest you have a look at that issue please thats where all this effort is coming from. If you know how to fix it in a different way we are more than happy to read your suggestions ... :) |
|
The problem is in |
|
Its sad that you saw this so late, I already spent like 2 full days on that ... |
|
I feared as much when I saw the issue. I'm sorry about that, this must have been a lot of work. |
|
Closing in favor of #2309. |
Cherry picked commits into new clean commit. Originally here:
#2233