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

Function CheckNonExistentIOArrays

tensorflow/lite/toco/tooling_util.cc:917–952  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

915}
916
917void CheckNonExistentIOArrays(const Model& model) {
918 // "non-existent" is interpreted in the stronger sense of
919 // "not actually produced/consumed by an op".
920 // Rationale: we have to artificially fix up TensorFlow graphs by creating
921 // any array that it refers to, so just checking that arrays exist isn't
922 // sufficient. The real invariant here is whether arrays are produced/consumed
923 // by something.
924 if (model.flags.allow_nonexistent_arrays()) {
925 return;
926 }
927 static constexpr char general_comment[] =
928 "Is it a typo? This should not happen. If you trigger this error "
929 "please send a bug report (with code to reporduce this error), to the "
930 "TensorFlow Lite team.";
931 for (const string& output_array : model.flags.output_arrays()) {
932 if (IsConstantParameterArray(model, output_array)) {
933 continue; // It is OK to request that a constant be an output.
934 }
935 QCHECK(GetOpWithOutput(model, output_array))
936 << "Specified output array \"" << output_array
937 << "\" is not produced by any op in this graph. " << general_comment;
938 }
939 for (const auto& rnn_state : model.flags.rnn_states()) {
940 if (!rnn_state.discardable()) {
941 // Check that all RNN states are consumed
942 QCHECK(GetOpWithInput(model, rnn_state.state_array()))
943 << "Specified RNN state \"" << rnn_state.state_array()
944 << "\" is not consumed by any op in this graph. " << general_comment;
945 // Check that all RNN back-edge source arrays are produced
946 QCHECK(GetOpWithOutput(model, rnn_state.back_edge_source_array()))
947 << "Specified RNN back-edge source array \""
948 << rnn_state.back_edge_source_array()
949 << "\" is not produced by any op in this graph. " << general_comment;
950 }
951 }
952}
953
954} // namespace
955

Callers 1

CheckNoMissingArrayFunction · 0.85

Calls 3

IsConstantParameterArrayFunction · 0.85
GetOpWithOutputFunction · 0.85
GetOpWithInputFunction · 0.85

Tested by

no test coverage detected