-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
numpy.reshape return wrong strides information in master #2949
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
Comments
@nouize thanks, I wondered if I should ask you about this... Yes this is something that has to be discussed. I personally think that this is correct (not the specific number of course), but it will have to be reverted in any case (possible with a new flag that keeps this behavior side by side). The PR, reverting is gh-2735, and if you have any opinion about it, or an idea on how to best handle this I would be interested. On the one hand code could break badly assuming things about strides, on the other hand doing copies etc. and not being able to signal how the memory really is layouted is a bit annoying. The |
Ok, sorry, I am trying to wrap my head around this, I mean its a very silly stride (and I have not yet figured out where it comes from) but why is it not aligned (and should we/you even check alignment for 1-sized strides)? |
@nouiz: Yes, can you clarify what you mean by "not aligned memory"? Both On Thu, Jan 24, 2013 at 10:25 AM, nouiz notifications@github.com wrote:
|
OK, wait. I am sorry, the code setting the strides in reshape seems to give uninitialized memory here, which when I tried happened to give aligned results. It used to work, because there was a special case of only adding/removing ones, which I removed, because the other code (with this exception) handled it already. With the whole strides discussion I was wondering about adding a stride cleaning function to set these strides to reasonable values, maybe it is time to implement that to use here. |
I did a take on fixing this in gh-2950 there are probably other ways to fill things, or you could take care about strides some more (considering the whole strides discussion), but that should fix it. @nouiz I would be very interested if you have any opinion about the strides of 1 dimensional axes thing in general... |
@njsmith What I mean by not aligned memory, is that in the master the ndarray flag aligned is false, when it is true in 1.6.1. Theano do not support not aligned ndarray, so we automatically check this flag and automatically raise an error when we see one. I suppose the not initiailized strides cause a function that check if the ndarray is aligned or not to think it isn't aligned. This bring the question, should the function that compute the align flag be updated to ignore the strides of dimensions of 1? @seberg I think gh-2950 should fix my problem. thanks |
This is fixed in master. |
On master in commit 2b4c9a6, I have this:
With numpy 1.6.1, I have this output:
(8,24,144)
I expect the numpy 1.6.1 give the right outputs.
This cause problem in Theano tests as we do not support not aligned memory. In master, the ndarray isn't aligned due to the bad strides. We can work around in theano by checking the output of reshape, but maybe this can affect other people.
I think there was some discussion on strides for dimensions of shape 1, but I'm not sure and I probably didn't followed them closely. Do someone remember that?
The text was updated successfully, but these errors were encountered: