MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / LinearIndex

Method LinearIndex

tensorflow/lite/delegates/gpu/common/shape.h:463–470  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 2

sizeFunction · 0.50
getFunction · 0.50

Tested by

no test coverage detected