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

Method TryGetSubshape

tensorflow/compiler/xla/shape_util.cc:792–805  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

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) {

Callers

nothing calls this directly

Calls 6

InvalidArgumentFunction · 0.85
tuple_shapes_sizeMethod · 0.80
IsTupleMethod · 0.45
ToStringMethod · 0.45
DebugStringMethod · 0.45
tuple_shapesMethod · 0.45

Tested by

no test coverage detected