C code for subtensor don't work when the length is maximal
https://deeplearning.net/software/theano_rb/r/1957/
Using this special code is not working in corner case. The logic of NONE_CODE make that if one user use that value in his code in a slice, he won't have what he think. I.e. var[(sys.maxint - 1, sys.maxint - 1, 1)] won't work as expected.
Did you check if the maxlength is sys.maxint? If so the last index is sys.maxint - 1.
Here is one case where it don't work. step is 1. If start is None or sys.maxint - 1, it is not equivalent. The first it mean start from the beginning. The second it mean start at the last element (there would be one or 0 element depending of the stop).
It also don't work for stop. In the case where start is sys.maxint - 2, if stop is None it should and do return a slice that contain only the last two elements. But if stop is sys.maxint - 1, it mean return a slice with only one element as the stop is not inclusive.
We need to change this mechanism to have another array in C that tell it each element in subensor_spec is None or not.
Using this special code is not working in corner case. The logic of NONE_CODE make that if one user use that value in his code in a slice, he won't have what he think. I.e. var[(sys.maxint - 1, sys.maxint - 1, 1)] won't work as expected.
Did you check if the maxlength is sys.maxint? If so the last index is sys.maxint - 1.
Here is one case where it don't work. step is 1. If start is None or sys.maxint - 1, it is not equivalent. The first it mean start from the beginning. The second it mean start at the last element (there would be one or 0 element depending of the stop).
It also don't work for stop. In the case where start is sys.maxint - 2, if stop is None it should and do return a slice that contain only the last two elements. But if stop is sys.maxint - 1, it mean return a slice with only one element as the stop is not inclusive.
We need to change this mechanism to have another array in C that tell it each element in subensor_spec is None or not.
Leave a comment