Skip to content

Commit

Permalink
casting tellg to size_type correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
gedoensmax committed Jul 17, 2024
1 parent c6022be commit 537bd95
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions onnxruntime/test/perftest/ort_test_session.cc
Original file line number Diff line number Diff line change
Expand Up @@ -820,11 +820,12 @@ select from 'TF8', 'TF16', 'UINT8', 'FLOAT', 'ITENSOR'. \n)");
if (!performance_test_config.model_info.load_via_path) {
session_ = Ort::Session(env, performance_test_config.model_info.model_file_path.c_str(), session_options);
} else {
std::fstream file(performance_test_config.model_info.model_file_path.c_str(), std::fstream::binary | std::fstream::in | std::fstream::ate);
std::ifstream file(performance_test_config.model_info.model_file_path.c_str(),
std::ios::binary | std::ios::in | std::ios::ate);
if (file.is_open()) {
const size_t fsize = file.tellg();
const std::streamsize fsize = file.tellg();
file.seekg(0, std::ios_base::beg);
std::vector<char> model_bytes(fsize);
std::vector<char> model_bytes(narrow<size_t>(fsize));
file.read(model_bytes.data(), fsize);
session_ = Ort::Session(env, model_bytes.data(), model_bytes.size(), session_options);
} else {
Expand Down

0 comments on commit 537bd95

Please sign in to comment.