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

Function ForEachMutableSubshapeHelper

tensorflow/compiler/xla/shape_util.cc:875–888  ·  view source on GitHub ↗

Helper for ForEachMutableSubshape which visits the subshapes of the given shape in DFS pre-order starting with the index.

Source from the content-addressed store, hash-verified

873// Helper for ForEachMutableSubshape which visits the subshapes of the given
874// shape in DFS pre-order starting with the index.
875Status ForEachMutableSubshapeHelper(
876 Shape* shape, const ShapeUtil::MutatingStatusVisitorFunction& func,
877 ShapeIndex* index) {
878 TF_RETURN_IF_ERROR(func(shape, *index));
879 if (shape->IsTuple()) {
880 for (int64 i = 0; i < ShapeUtil::TupleElementCount(*shape); ++i) {
881 index->push_back(i);
882 TF_RETURN_IF_ERROR(ForEachMutableSubshapeHelper(
883 shape->mutable_tuple_shapes(i), func, index));
884 index->pop_back();
885 }
886 }
887 return Status::OK();
888}
889
890} // namespace
891

Callers 2

Calls 5

mutable_tuple_shapesMethod · 0.80
pop_backMethod · 0.80
funcFunction · 0.50
IsTupleMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected