| 62 | |
| 63 | template<typename T> |
| 64 | Array<T> modDims(const Array<T> &in, const af::dim4 &newDims) { |
| 65 | if (in.isLinear() == false) { |
| 66 | // Nonlinear array's shape cannot be modified. Copy the data and modify |
| 67 | // the shape of the array |
| 68 | Array<T> out = copyArray<T>(in); |
| 69 | out.setDataDims(newDims); |
| 70 | return out; |
| 71 | } else if (in.isReady()) { |
| 72 | /// If the array is a buffer, modify the dimension and return |
| 73 | auto out = in; |
| 74 | out.setDataDims(newDims); |
| 75 | return out; |
| 76 | } else { |
| 77 | /// If the array is a node and not linear and not a buffer, then create |
| 78 | /// a moddims node |
| 79 | auto out = moddimOp<T>(in, newDims); |
| 80 | return out; |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | template<typename T> |
| 85 | detail::Array<T> flat(const detail::Array<T> &in) { |
no test coverage detected