Translates given coordinates of the layout into a linear index assuming dimensions are sorted in tensor access order e.g. if you access foobar[i][j][k] order of coordinates should be i,j,k.
| 461 | // dimensions are sorted in tensor access order e.g. if you access |
| 462 | // foobar[i][j][k] order of coordinates should be i,j,k. |
| 463 | int64_t LinearIndex( |
| 464 | const std::array<int32_t, StrongShape::size()>& coordinates) const { |
| 465 | int64_t index = coordinates[0]; |
| 466 | for (int i = 1; i < StrongShape::size(); ++i) { |
| 467 | index = index * StrongShape::get(i) + coordinates[i]; |
| 468 | } |
| 469 | return index; |
| 470 | } |
| 471 | |
| 472 | // Copies all dimensions from the given generic shape into specific shape. |
| 473 | // It requires shape to have all axis defined in the given |