| 23 | namespace xla { |
| 24 | |
| 25 | Status ShapeLayout::CopyLayoutFromShape(const Shape& other_shape) { |
| 26 | if (!ShapeUtil::Compatible(other_shape, shape_)) { |
| 27 | return InvalidArgument("Shape %s is not compatible with shape %s", |
| 28 | ShapeUtil::HumanString(other_shape), |
| 29 | ShapeUtil::HumanString(shape())); |
| 30 | } |
| 31 | shape_ = other_shape; |
| 32 | return Status::OK(); |
| 33 | } |
| 34 | |
| 35 | Status ShapeLayout::AssignLayoutToShape(Shape* to_shape) const { |
| 36 | if (!ShapeUtil::Compatible(*to_shape, shape_)) { |