| 32 | } |
| 33 | |
| 34 | Maybe<void> FlatShape::Check(const Shape& shape) const { |
| 35 | CHECK_EQ_OR_RETURN(this->dim_size(), shape.NumAxes()) |
| 36 | << Error::RuntimeError() |
| 37 | << "Expected same shape on each rank, but found at least two shapes, " |
| 38 | << JUST(ToShape())->ToString() << " and " << shape.ToString() << "!"; |
| 39 | for (int i = 0; i < this->dim_size(); ++i) { CHECK_EQ_OR_RETURN(this->dim(i), shape.At(i)); } |
| 40 | return Maybe<void>::Ok(); |
| 41 | } |
| 42 | |
| 43 | Maybe<void> FlatShape::Check(const FlatShape& flat_shape) const { |
| 44 | CHECK_EQ_OR_RETURN(this->dim_size(), flat_shape.NumAxes()) |