[Numpy-discussion] variable end border in arrays

Pablo pnavarre at gmail.com
Fri Jun 5 03:17:13 EDT 2015

If I want to remove 1 element in the beginning and the end of a numpy 
array "x" we do:


Now, if we have a border variable, and borders are allowed to be zero 
(which means no border), numpy syntax is inconvenient. For example if 
border=numpy.asarray([1,0]) and we try


it will produce an empty array because border[1]==0 is not considered 
respect to the end of the array anymore.
Is it possible to solve this without if/else's ? (I work with images and 
tensor's so if/else's have too many possible combinations)


More information about the NumPy-Discussion mailing list