| 18 | |
| 19 | template<typename T> |
| 20 | Array<T> diff(const Array<T> &in, const int dim, const bool isDiff2) { |
| 21 | const af::dim4 &iDims = in.dims(); |
| 22 | af::dim4 oDims = iDims; |
| 23 | oDims[dim] -= (isDiff2 + 1); |
| 24 | |
| 25 | if (iDims.elements() == 0 || oDims.elements() == 0) { |
| 26 | AF_ERROR("Elements are 0", AF_ERR_SIZE); |
| 27 | } |
| 28 | |
| 29 | Array<T> out = createEmptyArray<T>(oDims); |
| 30 | |
| 31 | kernel::diff<T>(out, in, in.ndims(), dim, isDiff2); |
| 32 | |
| 33 | return out; |
| 34 | } |
| 35 | |
| 36 | template<typename T> |
| 37 | Array<T> diff1(const Array<T> &in, const int dim) { |