ONE - On-device Neural Engine
Loading...
Searching...
No Matches
nnfw_exception_bindings.cc
Go to the documentation of this file.
1/*
2 * Copyright (c) 2025 Samsung Electronics Co., Ltd. All Rights Reserved
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
18
19#include "nnfw_exceptions.h"
20
21#include <pybind11/pybind11.h>
22
23namespace onert::api::python
24{
25
26namespace py = pybind11;
27
28void bind_nnfw_exceptions(py::module_ &m)
29{
30 // register base first
31 py::register_exception<NnfwError>(m, "OnertError", PyExc_RuntimeError);
32
33 // derived exceptions, each inheriting from NnfwError in Python as well
34 py::register_exception<NnfwUnexpectedNullError>(m, "OnertUnexpectedNullError",
35 m.attr("OnertError").cast<py::object>());
36 py::register_exception<NnfwInvalidStateError>(m, "OnertInvalidStateError",
37 m.attr("OnertError").cast<py::object>());
38 py::register_exception<NnfwOutOfMemoryError>(m, "OnertOutOfMemoryError",
39 m.attr("OnertError").cast<py::object>());
40 py::register_exception<NnfwInsufficientOutputError>(m, "OnertInsufficientOutputError",
41 m.attr("OnertError").cast<py::object>());
42 py::register_exception<NnfwDeprecatedApiError>(m, "OnertDeprecatedApiError",
43 m.attr("OnertError").cast<py::object>());
44}
45
46} // namespace onert::api::python
void bind_nnfw_exceptions(py::module_ &m)