| 483 | } |
| 484 | |
| 485 | Status VerifyShapesCompatible(const std::vector<PartialTensorShape>& expected, |
| 486 | const std::vector<PartialTensorShape>& received) { |
| 487 | if (expected.size() != received.size()) { |
| 488 | return errors::InvalidArgument( |
| 489 | "Number of components does not match: expected ", expected.size(), |
| 490 | " shapes but got ", received.size(), "."); |
| 491 | } |
| 492 | for (size_t i = 0; i < expected.size(); ++i) { |
| 493 | if (!expected[i].IsCompatibleWith(received[i])) { |
| 494 | return errors::InvalidArgument("Incompatible shapes at component ", i, |
| 495 | ": expected ", expected[i].DebugString(), |
| 496 | " but got ", received[i].DebugString(), |
| 497 | "."); |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | return Status::OK(); |
| 502 | } |
| 503 | |
| 504 | uint64 HashSubgraphFunction(const FunctionDefLibrary& library, |
| 505 | const FunctionDef* f) { |