| 151 | } |
| 152 | |
| 153 | inline int offset(const int n, const int c = 0, const int h = 0, |
| 154 | const int w = 0) const { |
| 155 | CHECK_GE(n, 0); |
| 156 | CHECK_LE(n, num()); |
| 157 | CHECK_GE(channels(), 0); |
| 158 | CHECK_LE(c, channels()); |
| 159 | CHECK_GE(height(), 0); |
| 160 | CHECK_LE(h, height()); |
| 161 | CHECK_GE(width(), 0); |
| 162 | CHECK_LE(w, width()); |
| 163 | return ((n * channels() + c) * height() + h) * width() + w; |
| 164 | } |
| 165 | |
| 166 | inline int offset(const vector<int>& indices) const { |
| 167 | CHECK_LE(indices.size(), num_axes()); |