| 1389 | } |
| 1390 | |
| 1391 | bool getEngineBuildEnv( |
| 1392 | const ModelOptions& model, BuildOptions const& build, SystemOptions& sys, BuildEnvironment& env, std::ostream& err) |
| 1393 | { |
| 1394 | bool createEngineSuccess{false}; |
| 1395 | |
| 1396 | if (build.load) |
| 1397 | { |
| 1398 | createEngineSuccess = loadEngineToBuildEnv(build.engine, build.safe && build.consistency, env, err); |
| 1399 | } |
| 1400 | else |
| 1401 | { |
| 1402 | createEngineSuccess = modelToBuildEnv(model, build, sys, env, err); |
| 1403 | } |
| 1404 | |
| 1405 | SMP_RETVAL_IF_FALSE(createEngineSuccess, "Failed to create engine from model or file.", false, err); |
| 1406 | |
| 1407 | if (build.save) |
| 1408 | { |
| 1409 | std::ofstream engineFile(build.engine, std::ios::binary); |
| 1410 | engineFile.write(reinterpret_cast<char const*>(env.engine.getBlob().data()), env.engine.getBlob().size()); |
| 1411 | SMP_RETVAL_IF_FALSE(!engineFile.fail(), "Saving engine to file failed.", false, err); |
| 1412 | } |
| 1413 | |
| 1414 | return true; |
| 1415 | } |
| 1416 | |
| 1417 | // There is not a getWeightsName API, so we need to use WeightsRole. |
| 1418 | std::vector<std::pair<WeightsRole, Weights>> getAllRefitWeightsForLayer(const ILayer& l) |
no test coverage detected