| 103 | |
| 104 | template<typename T> |
| 105 | void transpose_conj(Param<T> output, CParam<T> input) { |
| 106 | const af::dim4 odims = output.dims(); |
| 107 | const af::dim4 ostrides = output.strides(); |
| 108 | const af::dim4 istrides = input.strides(); |
| 109 | |
| 110 | T *out = output.get(); |
| 111 | T const *const in = input.get(); |
| 112 | |
| 113 | for (dim_t l = 0; l < odims[3]; ++l) { |
| 114 | for (dim_t k = 0; k < odims[2]; ++k) { |
| 115 | // Outermost loop handles batch mode |
| 116 | // if input has no data along third dimension |
| 117 | // this loop runs only once |
| 118 | |
| 119 | for (dim_t j = 0; j < odims[1]; ++j) { |
| 120 | for (dim_t i = 0; i < odims[0]; ++i) { |
| 121 | // calculate array indices based on offsets and strides |
| 122 | // the helper getIdx takes care of indices |
| 123 | const dim_t inIdx = getIdx(istrides, j, i, k, l); |
| 124 | const dim_t outIdx = getIdx(ostrides, i, j, k, l); |
| 125 | out[outIdx] = getConjugate(in[inIdx]); |
| 126 | } |
| 127 | } |
| 128 | // outData and inData pointers doesn't need to be |
| 129 | // offset as the getIdx function is taking care |
| 130 | // of the batch parameter |
| 131 | } |
| 132 | } |
| 133 | } |
| 134 | |
| 135 | template<typename T> |
| 136 | void transpose(Param<T> out, CParam<T> in, const bool conjugate) { |
nothing calls this directly
no test coverage detected