Helper for ForEachMutableSubshape which visits the subshapes of the given shape in DFS pre-order starting with the index.
| 873 | // Helper for ForEachMutableSubshape which visits the subshapes of the given |
| 874 | // shape in DFS pre-order starting with the index. |
| 875 | Status 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 |
no test coverage detected