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

Function update_base_index

src/core/tensor/tensor_math_cpp.h:102–106  ·  view source on GitHub ↗

this function updates the base indexes with the current index after every single traversal step, can be generalized beyond 2d cases

Source from the content-addressed store, hash-verified

100// single traversal step,
101// can be generalized beyond 2d cases
102void update_base_index(const Tensor &x, vector<int> &traversal_info) {
103 for (int n = 0; n < (traversal_info[x.shape().size() + 1] + 1); ++n) {
104 traversal_info[n] = traversal_info[x.shape().size()];
105 }
106};
107
108// function to traverse a const strided tensor object
109// it requires an additional vector, traversal_info {0,0,0,0 ...}, comprising

Callers 1

traverse_nextFunction · 0.85

Calls 2

shapeMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected