MCPcopy Create free account
hub / github.com/apache/singa / determine_order

Function determine_order

src/core/tensor/tensor_math_cpp.h:90–97  ·  view source on GitHub ↗

this function checks whether the next index falls on a special multiplier of the outer shape so the algorithm knows when to jump over/back to a starting element of the outer shape for e.g. in [[1,4,7], [2,5,8], [3,6,9]], elements 1,2,3 are the starting elements of their respective rows this additional check only has 1 loop for 2d matrix but runtime performance might degrade to O(nlog(n)) for highe

Source from the content-addressed store, hash-verified

88// but runtime performance might degrade to O(nlog(n)) for higher dimensional
89// tensors
90int determine_order(vector<int> &shape_multipliers, int counter) {
91 for (size_t n = 0; n < (shape_multipliers.size() - 1); ++n) {
92 if ((counter % shape_multipliers[n]) == 0) {
93 return ((shape_multipliers.size()) - 1 - n);
94 }
95 }
96 return 0;
97};
98
99// this function updates the base indexes with the current index after every
100// single traversal step,

Callers 1

traverse_nextFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected