@@ -115,6 +115,17 @@ std::vector<std::shared_ptr<IGraph>> PluginCompilerAdapter::compileWS(const std:
115
115
116
116
_logger.debug (" compile start" );
117
117
118
+ const auto starts_with = [](const std::string& str, const std::string& prefix) {
119
+ return str.substr (0 , prefix.size ()) == prefix;
120
+ };
121
+ const auto isInit = [&](std::string name) {
122
+ return starts_with (name, " init" );
123
+ };
124
+
125
+ const auto isMain = [&](std::string name) {
126
+ return starts_with (name, " main" );
127
+ };
128
+
118
129
switch (config.get <SEPARATE_WEIGHTS_VERSION>()) {
119
130
case 1 : {
120
131
const std::vector<std::shared_ptr<NetworkDescription>> initMainNetworkDescriptions =
@@ -124,8 +135,47 @@ std::vector<std::shared_ptr<IGraph>> PluginCompilerAdapter::compileWS(const std:
124
135
mainNetworkDescription = initMainNetworkDescriptions[1 ];
125
136
} break ;
126
137
case 2 : {
127
- initNetworkDescription = _compiler->compileWS_v2 (model, config);
128
- mainNetworkDescription = _compiler->compileWS_v2 (model, config);
138
+ // initNetworkDescription = _compiler->compileWS_v2(model, config);
139
+ // mainNetworkDescription = _compiler->compileWS_v2(model, config);
140
+
141
+ std::vector<std::shared_ptr<NetworkDescription>> initDscrs;
142
+ while (auto networkDescription = _compiler->compileWS_v2 (model, config)) {
143
+ if (isInit (networkDescription->metadata .name )) {
144
+ initDscrs.push_back (networkDescription);
145
+ continue ;
146
+ }
147
+ if (!isMain (networkDescription->metadata .name )) {
148
+ throw std::runtime_error (" Unexpected network name: " + networkDescription->metadata .name );
149
+ }
150
+
151
+ mainNetworkDescription = std::move (networkDescription);
152
+ break ;
153
+ }
154
+
155
+ // FIXME
156
+ initNetworkDescription = std::move (initDscrs[0 ]);
157
+ } break ;
158
+ case 3 : {
159
+ // initNetworkDescription = _compiler->compileWS_v3(model, config, 0);
160
+ // mainNetworkDescription = _compiler->compileWS_v3(model, config, 1);
161
+
162
+ std::vector<std::shared_ptr<NetworkDescription>> initDscrs;
163
+ size_t i = 0 ;
164
+ while (auto networkDescription = _compiler->compileWS_v3 (model, config, i++)) {
165
+ if (isInit (networkDescription->metadata .name )) {
166
+ initDscrs.push_back (networkDescription);
167
+ continue ;
168
+ }
169
+ if (!isMain (networkDescription->metadata .name )) {
170
+ throw std::runtime_error (" Unexpected network name: " + networkDescription->metadata .name );
171
+ }
172
+
173
+ mainNetworkDescription = std::move (networkDescription);
174
+ break ;
175
+ }
176
+
177
+ // FIXME
178
+ initNetworkDescription = std::move (initDscrs[0 ]);
129
179
} break ;
130
180
default :
131
181
OPENVINO_THROW (" Invalid \" SEPARATE_WEIGHTS_VERSION\" value found within the \" compileWS\" call" );
0 commit comments