| 420 | |
| 421 | namespace { |
| 422 | Status ValidateNode(const NodeDef& node) { |
| 423 | const auto node_iterator = node.attr().find("value"); |
| 424 | if (node_iterator != node.attr().end()) { |
| 425 | AttrValue node_value = node_iterator->second; |
| 426 | if (node_value.has_tensor()) { |
| 427 | const PartialTensorShape node_shape(node_value.tensor().tensor_shape()); |
| 428 | if (node_shape.num_elements() < 0) { |
| 429 | return errors::FailedPrecondition( |
| 430 | "Saved model contains node \"", node.name(), "\" (op \"", node.op(), |
| 431 | "\") which initializes from a tensor with ", |
| 432 | node_shape.num_elements(), " elements"); |
| 433 | } |
| 434 | } |
| 435 | } else if (node.op() == "Const") { |
| 436 | return errors::FailedPrecondition( |
| 437 | "Saved model contains node \"", node.name(), |
| 438 | "\" which is a constant tensor but no value has been provided"); |
| 439 | } |
| 440 | return Status::OK(); |
| 441 | } |
| 442 | |
| 443 | Status ValidateFunctionNotRecursive(const FunctionDef& function) { |
| 444 | const auto& function_name = function.signature().name(); |
no test coverage detected