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

Function ValidateNode

serving/processor/serving/util.cc:422–441  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420
421namespace {
422Status 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
443Status ValidateFunctionNotRecursive(const FunctionDef& function) {
444 const auto& function_name = function.signature().name();

Callers 1

ValidateSavedTensorsFunction · 0.70

Calls 8

FailedPreconditionFunction · 0.85
attrMethod · 0.80
nameMethod · 0.65
findMethod · 0.45
endMethod · 0.45
tensorMethod · 0.45
num_elementsMethod · 0.45
opMethod · 0.45

Tested by

no test coverage detected