Skip to content

Commit

Permalink
always import file in the buffer ASIS so no text conversion on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
r2d3 committed Nov 3, 2017
1 parent b30d625 commit 31b52e8
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions modules/dnn/test/test_tf_importer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,9 @@ TEST(Test_TensorFlow, inception_accuracy)
normAssert(ref, out);
}

static bool readFileInMemory(const string& filename, string& content, bool isBinary)
static bool readFileInMemory(const string& filename, string& content)
{
std::ios::openmode mode = std::ios::in;
if (isBinary)
mode |= std::ios::binary;

std::ios::openmode mode = std::ios::in | std::ios::binary;
std::ifstream ifs(filename.c_str(), mode);
if (!ifs.is_open())
return false;
Expand Down Expand Up @@ -110,11 +107,11 @@ static void runTensorFlowNet(const std::string& prefix, bool hasText = false,
{
// Load files into a memory buffers
string dataModel;
ASSERT_TRUE(readFileInMemory(netPath, dataModel, true));
ASSERT_TRUE(readFileInMemory(netPath, dataModel));

string dataConfig;
if (hasText)
ASSERT_TRUE(readFileInMemory(netConfig, dataConfig, false));
ASSERT_TRUE(readFileInMemory(netConfig, dataConfig));

net = readNetFromTensorflow(dataModel.c_str(), dataModel.size(),
dataConfig.c_str(), dataConfig.size());
Expand Down

0 comments on commit 31b52e8

Please sign in to comment.