From 62002b4cf0ae1b633c791a3fe9a1b547ecfac3ba Mon Sep 17 00:00:00 2001 From: =?utf8?q?=EC=9D=B4=EC=83=81=EA=B7=9C/On-Device=20Lab=28SR=29/Princip?= =?utf8?q?al=20Engineer/=EC=82=BC=EC=84=B1=EC=A0=84=EC=9E=90?= Date: Thu, 10 Oct 2019 13:32:39 +0900 Subject: [PATCH] [nnpkg-run] set default backend using OP_BACKEND_ALLOPS environment var. (#8003) `nnpackage-run` (in short, `nnpkg-run`) uses `nnfw_session` from nnfw APIs. It uses GeneralConfigSource. It means we need to set configuration using nnfw APIs. Thus, it reads from environment var and set default backends. Signed-off-by: Sanggyu Lee --- tests/tools/nnpackage_run/src/nnpackage_run.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/tools/nnpackage_run/src/nnpackage_run.cc b/tests/tools/nnpackage_run/src/nnpackage_run.cc index 97edebf..3e849cd 100644 --- a/tests/tools/nnpackage_run/src/nnpackage_run.cc +++ b/tests/tools/nnpackage_run/src/nnpackage_run.cc @@ -70,6 +70,9 @@ int main(const int argc, char **argv) nnfw_session *session = nullptr; NNPR_ENSURE_STATUS(nnfw_create_session(&session)); + char *default_backend = std::getenv("OP_BACKEND_ALLOPS"); + if (default_backend) + NNPR_ENSURE_STATUS(nnfw_set_default_backend(session, default_backend)); NNPR_ENSURE_STATUS(nnfw_load_model_from_file(session, nnpackage_path.c_str())); uint32_t num_inputs; -- 2.7.4