recently I needed a way to zeropad a 2D array with pyopencl like
numpy.pad() does. Since changing array size only works in the first
dimension I came up with this:
concatenate old array with zeros <- in 1st dim
transpose new array <- flip dims
concatenate new array with zeros <- again in 1st dim
transpose again <- flip back dims
That works well with the Transposition() in Bogdan Opanchuk's Reikna
package. I only need to do a reshape() after each transposition.
With pyopencl's transpose() strides are also flipped so I can't carry
out the 2nd transposition (strides don't match). So here is my question:
How can I make use of transpose() when the result always has flipped
Also, can you think of a simpler way to zeropad in 2D? The array should
be padded symmetrically so that the old array is embedded in the center
of the padded array.
Thanks in advance...