2 * Copyright (c) 2020 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 __CIRCLE_OP_REGISTRY_H__
18 #define __CIRCLE_OP_REGISTRY_H__
20 #include "CircleOpChef.h"
21 #include "CircleOpChefs.h"
29 * @brief circlechef operator registry
31 class CircleOpRegistry
35 * @brief Returns registered CircleOpChef pointer for BuiltinOperator or
36 * nullptr if not registered
38 const CircleOpChef *lookup(circle::BuiltinOperator op) const
40 if (_circleop_map.find(op) == _circleop_map.end())
43 return _circleop_map.at(op).get();
46 static CircleOpRegistry &get()
48 static CircleOpRegistry me;
55 #define REG_TFL_OP(OPCODE, CLASS) \
56 _circleop_map[circle::BuiltinOperator_##OPCODE] = std::make_unique<CLASS>()
58 REG_TFL_OP(BATCH_MATMUL, CircleOpBatchMatMul);
59 REG_TFL_OP(BCQ_FULLY_CONNECTED, CircleOpBCQFullyConnected);
60 REG_TFL_OP(BCQ_GATHER, CircleOpBCQGather);
61 REG_TFL_OP(INSTANCE_NORM, CircleOpInstanceNorm);
66 std::map<circle::BuiltinOperator, std::unique_ptr<CircleOpChef>> _circleop_map;
69 } // namespace circlechef
71 #endif // __CIRCLE_OP_REGISTRY_H__