MCPcopy Create free account
hub / github.com/ARM-software/armnn / LoadModelFromTextFile

Method LoadModelFromTextFile

src/armnnOnnxParser/OnnxParser.cpp:734–757  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

732}
733
734ModelPtr OnnxParserImpl::LoadModelFromTextFile(const char* graphFile)
735{
736 FILE* fd = fopen(graphFile, "r");
737
738 if (fd == nullptr)
739 {
740 throw FileNotFoundException(fmt::format("Invalid (null) filename {}", CHECK_LOCATION().AsString()));
741 }
742
743 // Parse the file into a message
744 ModelPtr modelProto = std::make_unique<onnx::ModelProto>();
745 using google::protobuf::io::FileInputStream;
746 std::unique_ptr<FileInputStream> input = std::make_unique<FileInputStream>(fileno(fd));
747 bool success = google::protobuf::TextFormat::Parse(input.get(), modelProto.get());
748 fclose(fd);
749
750 if (!success)
751 {
752 std::stringstream error;
753 error << "Failed to parse graph file";
754 throw ParseException(fmt::format("{} {}", error.str(), CHECK_LOCATION().AsString()));
755 }
756 return modelProto;
757}
758
759INetworkPtr OnnxParserImpl::CreateNetworkFromTextFile(const char* graphFile)
760{

Callers

nothing calls this directly

Calls 6

formatEnum · 0.85
ParseExceptionClass · 0.85
AsStringMethod · 0.45
getMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected