Skip to content

Commit d7ee534

Browse files
committed
optimize the code
update
1 parent 513e198 commit d7ee534

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

onnxruntime/core/providers/openvino/ov_stateful_patch_utils.cc

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -138,20 +138,16 @@ void PatchStatefulDecoder(std::shared_ptr<ov::Model> model) {
138138
std::vector<std::string> key_value_input_names;
139139
std::vector<std::string> not_kv_inputs;
140140
const auto& params = model->get_parameters();
141-
bool found = false;
141+
142142
for (size_t i = 0; i < params.size(); i++) {
143-
auto param_name = params.at(i)->output(0).get_any_name();
143+
auto param_name = params[i]->output(0).get_any_name();
144144
if (param_name.find("key_values") != std::string::npos) {
145-
key_value_input_names.push_back(param_name);
146-
found = true;
145+
key_value_input_names.push_back(param_name);
147146
} else if (param_name.find("keys") != std::string::npos) {
148-
key_value_input_names.push_back(param_name);
149-
found = true;
147+
key_value_input_names.push_back(param_name);
150148
} else if (param_name.find("values") != std::string::npos) {
151-
key_value_input_names.push_back(param_name);
152-
found = true;
153-
}
154-
if (!found) {
149+
key_value_input_names.push_back(param_name);
150+
} else{
155151
not_kv_inputs.push_back(param_name);
156152
}
157153
}

0 commit comments

Comments
 (0)