| 124 | }; |
| 125 | |
| 126 | inline int next_offset(int offset, const vector<size_t> &shape, |
| 127 | const vector<int> &stride, vector<int> *index) { |
| 128 | for (int k = shape.size() - 1; k >= 0; k--) { |
| 129 | if (index->at(k) + 1 < int(shape.at(k))) { |
| 130 | offset += stride.at(k); |
| 131 | index->at(k) += 1; |
| 132 | break; |
| 133 | } |
| 134 | index->at(k) = 0; |
| 135 | offset -= stride.at(k) * (shape.at(k) - 1); |
| 136 | } |
| 137 | return offset; |
| 138 | } |
| 139 | |
| 140 | template <typename DType> |
| 141 | void traverse_unary(const Tensor &in, Tensor *out, |
no test coverage detected