Revert "Header length for supported model detection is increased (#1340)" (#1354)

This reverts commit 5b2ec7840a.
This commit is contained in:
Rafal Blaczkowski 2020-07-16 17:09:45 +02:00 committed by GitHub
parent 949fee3cfc
commit e7861c7455
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 16 deletions

View File

@ -5,7 +5,6 @@
#include <fstream>
#include <xml_parse_utils.h>
#include <array>
namespace InferenceEngine {
namespace details {
@ -20,14 +19,14 @@ inline size_t GetIRVersion(pugi::xml_node& root) {
* @return IR version, 0 if model does represent IR
*/
size_t GetIRVersion(std::istream& model) {
std::array<char, 512> header = {};
model.seekg(0, model.beg);
model.read(header.data(), header.size());
const int header_size = 128;
std::string header(header_size, ' ');
model.read(&header[0], header_size);
model.seekg(0, model.beg);
pugi::xml_document doc;
auto res = doc.load_buffer(header.data(), header.size(), pugi::parse_default | pugi::parse_fragment, pugi::encoding_utf8);
auto res = doc.load_string(header.c_str(), pugi::parse_default | pugi::parse_fragment);
if (res == pugi::status_ok) {
pugi::xml_node root = doc.document_element();

View File

@ -199,19 +199,10 @@ TEST(NetReaderTest, IRSupportModelDetection) {
</net>
)V0G0N";
// For supported model detection the IRReader uses first 512 bytes from model.
// These headers shifts the trim place.
std::string headers[] = {
R"()",
R"(<!-- <net name="Network" version="10" some_attribute="Test Attribute"> -->)",
R"(<!-- <net name="Network" version="10" some_attribute="Test Attribute"> -->
<!-- <net name="Network" version="10" some_attribute="Test Attribute"> -->
<!-- <net name="Network" version="10" some_attribute="Test Attribute"> -->
<!-- <net name="Network" version="10" some_attribute="Test Attribute"> -->
<!-- The quick brown fox jumps over the lazy dog -->
<!-- The quick brown fox jumps over the lazy dog -->
<!-- The quick brown fox jumps over the lazy dog -->)"
R"(<!-- <net name="Network" version="100500"> -->)",
R"(<!-- <net name="Network" version="10" some_attribute="Test Attribute"> -->)"
};
InferenceEngine::Blob::CPtr weights;