2 * Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef __MIO_CIRCLE06_HELPER_H__
18 #define __MIO_CIRCLE06_HELPER_H__
20 #include <mio/circle/schema_generated.h>
29 ::circle::BuiltinOperator builtin_code_neutral(const ::circle::OperatorCode *opcode);
30 bool is_valid(const ::circle::OperatorCode *opcode);
31 bool is_custom(const ::circle::OperatorCode *opcode);
32 std::string opcode_name(const ::circle::OperatorCode *opcode);
33 const char *tensor_type(const ::circle::Tensor *tensor);
34 const char *tensor_name(const ::circle::Tensor *tensor);
36 template <typename T> std::vector<T> as_index_vector(const flatbuffers::Vector<T> *flat_array)
38 if (flat_array == nullptr)
40 throw std::runtime_error("flat array is nullptr");
43 std::vector<T> ret(flat_array->Length());
44 for (uint32_t i = 0; i < flat_array->Length(); i++)
46 ret[i] = flat_array->Get(i);
54 #endif // __MIO_CIRCLE06_HELPER_H__