| 49 | |
| 50 | template<typename T> |
| 51 | Array<T> padArrayBorders(const Array<T> &in, const dim4 &lowerBoundPadding, |
| 52 | const dim4 &upperBoundPadding, |
| 53 | const af::borderType btype) { |
| 54 | const dim4 &iDims = in.dims(); |
| 55 | |
| 56 | dim4 oDims(lowerBoundPadding[0] + iDims[0] + upperBoundPadding[0], |
| 57 | lowerBoundPadding[1] + iDims[1] + upperBoundPadding[1], |
| 58 | lowerBoundPadding[2] + iDims[2] + upperBoundPadding[2], |
| 59 | lowerBoundPadding[3] + iDims[3] + upperBoundPadding[3]); |
| 60 | |
| 61 | if (oDims == iDims) { return in; } |
| 62 | |
| 63 | auto ret = (btype == AF_PAD_ZERO ? createValueArray<T>(oDims, scalar<T>(0)) |
| 64 | : createEmptyArray<T>(oDims)); |
| 65 | |
| 66 | getQueue().enqueue(kernel::padBorders<T>, ret, in, lowerBoundPadding, |
| 67 | upperBoundPadding, btype); |
| 68 | return ret; |
| 69 | } |
| 70 | |
| 71 | template<typename T> |
| 72 | void multiply_inplace(Array<T> &in, double val); |