-
Notifications
You must be signed in to change notification settings - Fork 159
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[onert-micro] Introduce user interface entities (#12538)
This commit introduces user interface entities. ONE-DCO-1.0-Signed-off-by: Artem Balyshev <[email protected]> Co-authored-by: Artem Balyshev <[email protected]>
- Loading branch information
1 parent
e3eba64
commit 2f5c40a
Showing
4 changed files
with
188 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef ONERT_MICRO_CONFIG_H | ||
#define ONERT_MICRO_CONFIG_H | ||
|
||
namespace onert_micro | ||
{ | ||
|
||
struct OMConfig | ||
{ | ||
bool keep_input = false; | ||
bool cmsis_nn = false; | ||
}; | ||
|
||
} // namespace onert_micro | ||
|
||
#endif // ONERT_MICRO_CONFIG_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef ONERT_MICRO_INTERPRETER_H | ||
#define ONERT_MICRO_INTERPRETER_H | ||
|
||
#include "OMStatus.h" | ||
#include "OMConfig.h" | ||
|
||
#include "core/OMRuntimeModule.h" | ||
|
||
namespace onert_micro | ||
{ | ||
|
||
class OMInterpreter | ||
{ | ||
private: | ||
core::OMRuntimeModule _runtime_module; | ||
|
||
public: | ||
OMInterpreter() = default; | ||
OMInterpreter(const OMInterpreter &) = delete; | ||
OMInterpreter(OMInterpreter &&) = delete; | ||
OMInterpreter &operator=(const OMInterpreter &) = delete; | ||
OMInterpreter &&operator=(const OMInterpreter &&) = delete; | ||
~OMInterpreter() = default; | ||
|
||
OMStatus importModel(const char *model_ptr, const OMConfig &config); | ||
|
||
OMStatus run(); | ||
|
||
OMStatus reset(); | ||
|
||
uint32_t getNumberOfInputs(); | ||
uint32_t getNumberOfOutputs(); | ||
|
||
OMStatus allocateInputs(); | ||
|
||
uint32_t getInputSizeAt(uint32_t position); | ||
uint32_t getOutputSizeAt(uint32_t position); | ||
|
||
void *getInputDataAt(uint32_t position); | ||
void *getOutputDataAt(uint32_t position); | ||
}; | ||
|
||
} // namespace onert_micro | ||
|
||
#endif // ONERT_MICRO_INTERPRETER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#ifndef ONERT_MICRO_STATUS_H | ||
#define ONERT_MICRO_STATUS_H | ||
|
||
namespace onert_micro | ||
{ | ||
|
||
enum OMStatus | ||
{ | ||
Ok, | ||
UnsupportedType, | ||
UnsupportedActivation, | ||
UnsupportedOp, | ||
UnknownError, | ||
ModelNotImport, | ||
FailedCheckCondition, | ||
NoQuantization, | ||
UnsupportedDynamicShapeCase, | ||
}; | ||
|
||
} // namespace onert_micro | ||
|
||
#endif // ONERT_MICRO_STATUS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* Copyright (c) 2024 Samsung Electronics Co., Ltd. All Rights Reserved | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "OMInterpreter.h" | ||
|
||
using namespace onert_micro; | ||
|
||
OMStatus OMInterpreter::importModel(const char *model_ptr, const OMConfig &config) | ||
{ | ||
assert(model_ptr != nullptr && "Model ptr shouldn't be nullptr"); | ||
if (model_ptr == nullptr) | ||
return UnknownError; | ||
|
||
return _runtime_module.importModel(model_ptr, config); | ||
} | ||
|
||
OMStatus OMInterpreter::run() { return _runtime_module.run(); } | ||
|
||
OMStatus OMInterpreter::reset() { return _runtime_module.reset(); } | ||
|
||
uint32_t OMInterpreter::getNumberOfInputs() { return _runtime_module.getNumberOfInputs(); } | ||
|
||
uint32_t OMInterpreter::getNumberOfOutputs() { return _runtime_module.getNumberOfOutputs(); } | ||
|
||
void *OMInterpreter::getInputDataAt(uint32_t position) | ||
{ | ||
return _runtime_module.getInputDataAt(position); | ||
} | ||
|
||
void *OMInterpreter::getOutputDataAt(uint32_t position) | ||
{ | ||
return _runtime_module.getOutputDataAt(position); | ||
} | ||
|
||
uint32_t OMInterpreter::getInputSizeAt(uint32_t position) | ||
{ | ||
return _runtime_module.getInputSizeAt(position); | ||
} | ||
|
||
uint32_t OMInterpreter::getOutputSizeAt(uint32_t position) | ||
{ | ||
return _runtime_module.getOutputSizeAt(position); | ||
} | ||
|
||
OMStatus OMInterpreter::allocateInputs() { return _runtime_module.allocateInputs(); } |