DO NOT USE THIS FUNCTION FOR NEW FUNCTIONALITY BEYOND IMPLEMENTING BROADCASTING. Same as Offset(), except takes as NdArrayDesc instead of Dims .
| 505 | // |
| 506 | // Same as Offset(), except takes as NdArrayDesc<N> instead of Dims<N>. |
| 507 | inline int SubscriptToIndex(const NdArrayDesc<4>& desc, int i0, int i1, int i2, |
| 508 | int i3) { |
| 509 | TFLITE_DCHECK(i0 >= 0 && i0 < desc.extents[0]); |
| 510 | TFLITE_DCHECK(i1 >= 0 && i1 < desc.extents[1]); |
| 511 | TFLITE_DCHECK(i2 >= 0 && i2 < desc.extents[2]); |
| 512 | TFLITE_DCHECK(i3 >= 0 && i3 < desc.extents[3]); |
| 513 | return i0 * desc.strides[0] + i1 * desc.strides[1] + i2 * desc.strides[2] + |
| 514 | i3 * desc.strides[3]; |
| 515 | } |
| 516 | |
| 517 | // Given the dimensions of the operands for an element-wise binary broadcast, |
| 518 | // adjusts them so that they can be directly iterated over with simple loops. |
no outgoing calls
no test coverage detected