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

Method LoadModelFromBinaryFile

src/armnnOnnxParser/OnnxParser.cpp:813–839  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

811}
812
813ModelPtr OnnxParserImpl::LoadModelFromBinaryFile(const char* graphFile)
814{
815 FILE* fd = fopen(graphFile, "rb");
816
817 if (fd == nullptr)
818 {
819 throw FileNotFoundException(fmt::format("Invalid (null) filename {}", CHECK_LOCATION().AsString()));
820 }
821
822 // Parse the file into a message
823 ModelPtr modelProto = std::make_unique<onnx::ModelProto>();
824
825 google::protobuf::io::FileInputStream inStream(fileno(fd));
826 google::protobuf::io::CodedInputStream codedStream(&inStream);
827 codedStream.SetTotalBytesLimit(INT_MAX);
828 bool success = modelProto.get()->ParseFromCodedStream(&codedStream);
829 fclose(fd);
830
831 if (!success)
832 {
833 std::stringstream error;
834 error << "Failed to parse graph file";
835 throw ParseException(fmt::format("{} {}", error.str(), CHECK_LOCATION().AsString()));
836 }
837 return modelProto;
838
839}
840
841INetworkPtr OnnxParserImpl::CreateNetworkFromBinaryFile(const char* graphFile)
842{

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