static */
| 790 | } |
| 791 | |
| 792 | /* static */ StatusOr<const Shape*> ShapeUtil::TryGetSubshape( |
| 793 | const Shape& shape, ShapeIndexView index) { |
| 794 | const Shape* return_shape = &shape; |
| 795 | for (auto i : index) { |
| 796 | if (!return_shape->IsTuple() || i < 0 || |
| 797 | i >= return_shape->tuple_shapes_size()) { |
| 798 | return InvalidArgument( |
| 799 | "Shape index %s not a valid subshape index for tuple with shape %s", |
| 800 | index.ToString(), shape.DebugString()); |
| 801 | } |
| 802 | return_shape = &return_shape->tuple_shapes(i); |
| 803 | } |
| 804 | return return_shape; |
| 805 | } |
| 806 | |
| 807 | /* static */ Shape* ShapeUtil::GetMutableSubshape(Shape* shape, |
| 808 | ShapeIndexView index) { |
nothing calls this directly
no test coverage detected