mirror of
https://github.com/saymrwulf/onnxruntime.git
synced 2026-05-25 22:26:24 +00:00
Rename variable in InferenceSession class so as to not clash with an existing var (#4391)
* Rename variable in InferenceSession class so as to not clash with an existing var * Fix build break
This commit is contained in:
parent
f6bf66c8cf
commit
eabc1616e6
2 changed files with 14 additions and 13 deletions
|
|
@ -158,7 +158,7 @@ static Status FinalizeSessionOptions(const SessionOptions& user_provided_session
|
|||
|
||||
void InferenceSession::ConstructorCommon(const SessionOptions& session_options,
|
||||
const Environment& session_env) {
|
||||
auto status = FinalizeSessionOptions(session_options, model_proto_, model_loaded_, session_options_);
|
||||
auto status = FinalizeSessionOptions(session_options, model_proto_, is_model_proto_parsed_, session_options_);
|
||||
ORT_ENFORCE(status.IsOK(), "Could not finalize session options while constructing the inference session. Error Message: ",
|
||||
status.ErrorMessage());
|
||||
|
||||
|
|
@ -236,7 +236,7 @@ InferenceSession::InferenceSession(const SessionOptions& session_options, const
|
|||
auto status = Model::Load(model_location_, model_proto_);
|
||||
ORT_ENFORCE(status.IsOK(), "Given model could not be parsed while creating inference session. Error message: ",
|
||||
status.ErrorMessage());
|
||||
model_loaded_ = true;
|
||||
is_model_proto_parsed_ = true;
|
||||
// Finalize session options and initialize assets of this session instance
|
||||
ConstructorCommon(session_options, session_env);
|
||||
}
|
||||
|
|
@ -252,7 +252,7 @@ InferenceSession::InferenceSession(const SessionOptions& session_options,
|
|||
auto status = Model::Load(model_location_, model_proto_);
|
||||
ORT_ENFORCE(status.IsOK(), "Given model could not be parsed while creating inference session. Error message: ",
|
||||
status.ErrorMessage());
|
||||
model_loaded_ = true;
|
||||
is_model_proto_parsed_ = true;
|
||||
// Finalize session options and initialize assets of this session instance
|
||||
ConstructorCommon(session_options, session_env);
|
||||
}
|
||||
|
|
@ -266,7 +266,7 @@ InferenceSession::InferenceSession(const SessionOptions& session_options, const
|
|||
google::protobuf::io::IstreamInputStream zero_copy_input(&model_istream);
|
||||
const bool result = model_proto_.ParseFromZeroCopyStream(&zero_copy_input) && model_istream.eof();
|
||||
ORT_ENFORCE(result, "Could not parse model successfully while constructing the inference session");
|
||||
model_loaded_ = true;
|
||||
is_model_proto_parsed_ = true;
|
||||
// Finalize session options and initialize assets of this session instance
|
||||
ConstructorCommon(session_options, session_env);
|
||||
}
|
||||
|
|
@ -278,7 +278,7 @@ InferenceSession::InferenceSession(const SessionOptions& session_options, const
|
|||
insert_cast_transformer_("CastFloat16Transformer") {
|
||||
const bool result = model_proto_.ParseFromArray(model_data, model_data_len);
|
||||
ORT_ENFORCE(result, "Could not parse model successfully while constructing the inference session");
|
||||
model_loaded_ = true;
|
||||
is_model_proto_parsed_ = true;
|
||||
// Finalize session options and initialize assets of this session instance
|
||||
ConstructorCommon(session_options, session_env);
|
||||
}
|
||||
|
|
@ -458,7 +458,7 @@ common::Status InferenceSession::Load(const std::basic_string<T>& model_uri) {
|
|||
}
|
||||
|
||||
common::Status InferenceSession::Load(const std::string& model_uri) {
|
||||
if (model_loaded_) {
|
||||
if (is_model_proto_parsed_) {
|
||||
return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL,
|
||||
"ModelProto corresponding to the model to be loaded has already been parsed. "
|
||||
"Invoke Load().");
|
||||
|
|
@ -469,7 +469,7 @@ common::Status InferenceSession::Load(const std::string& model_uri) {
|
|||
|
||||
#ifdef _WIN32
|
||||
common::Status InferenceSession::Load(const std::wstring& model_uri) {
|
||||
if (model_loaded_) {
|
||||
if (is_model_proto_parsed_) {
|
||||
return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL,
|
||||
"ModelProto corresponding to the model to be loaded has already been parsed. "
|
||||
"Invoke Load().");
|
||||
|
|
@ -480,7 +480,7 @@ common::Status InferenceSession::Load(const std::wstring& model_uri) {
|
|||
#endif
|
||||
|
||||
common::Status InferenceSession::Load(const ModelProto& model_proto) {
|
||||
if (model_loaded_) {
|
||||
if (is_model_proto_parsed_) {
|
||||
return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL,
|
||||
"ModelProto corresponding to the model to be loaded has already been parsed. "
|
||||
"Invoke Load().");
|
||||
|
|
@ -502,7 +502,7 @@ common::Status InferenceSession::Load(const ModelProto& model_proto) {
|
|||
}
|
||||
|
||||
common::Status InferenceSession::Load(std::unique_ptr<ModelProto> p_model_proto) {
|
||||
if (model_loaded_) {
|
||||
if (is_model_proto_parsed_) {
|
||||
return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL,
|
||||
"ModelProto corresponding to the model to be loaded has already been parsed. "
|
||||
"Invoke Load().");
|
||||
|
|
@ -523,7 +523,7 @@ common::Status InferenceSession::Load(std::unique_ptr<ModelProto> p_model_proto)
|
|||
}
|
||||
|
||||
common::Status InferenceSession::Load(std::istream& model_istream) {
|
||||
if (model_loaded_) {
|
||||
if (is_model_proto_parsed_) {
|
||||
return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL,
|
||||
"ModelProto corresponding to the model to be loaded has already been parsed. "
|
||||
"Invoke Load().");
|
||||
|
|
@ -552,7 +552,7 @@ common::Status InferenceSession::Load(std::istream& model_istream) {
|
|||
}
|
||||
|
||||
common::Status InferenceSession::Load(const void* model_data, int model_data_len) {
|
||||
if (model_loaded_) {
|
||||
if (is_model_proto_parsed_) {
|
||||
return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL,
|
||||
"ModelProto corresponding to the model to be loaded has already been parsed. "
|
||||
"Invoke Load().");
|
||||
|
|
@ -581,7 +581,7 @@ common::Status InferenceSession::Load(const void* model_data, int model_data_len
|
|||
}
|
||||
|
||||
common::Status InferenceSession::Load() {
|
||||
if (!model_loaded_) {
|
||||
if (!is_model_proto_parsed_) {
|
||||
return ORT_MAKE_STATUS(ONNXRUNTIME, FAIL,
|
||||
"ModelProto corresponding to the model to be loaded has not been parsed yet. "
|
||||
"This API should be called in conjunction with a ctor that takes a model abstraction.");
|
||||
|
|
|
|||
|
|
@ -552,7 +552,8 @@ class InferenceSession {
|
|||
// used to hold the ModelProto parsed in an applicable ctor to be used while calling parameter-less Load()
|
||||
ONNX_NAMESPACE::ModelProto model_proto_;
|
||||
|
||||
bool model_loaded_ = false;
|
||||
// Flag indicating if ModelProto has been parsed in an applicable ctor
|
||||
bool is_model_proto_parsed_ = false;
|
||||
};
|
||||
|
||||
struct SessionIOBinding {
|
||||
|
|
|
|||
Loading…
Reference in a new issue