2 * Copyright (c) 2019 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 __OPERATION_FACTORY_H__
18 #define __OPERATION_FACTORY_H__
20 #include <unordered_map>
22 #include "ir/Operands.h"
23 #include "ir/Operation.h"
24 #include "NeuralNetworks.h"
25 #include "NeuralNetworksEx.h"
28 * @brief A class to create a onert operation object from NN API input parameters
30 class OperationFactory
36 const uint32_t *inputs;
37 uint32_t output_count;
38 const uint32_t *outputs;
43 std::function<onert::ir::Operation *(const OperationFactory::Param &, onert::ir::Operands &)>;
46 static OperationFactory &get();
52 onert::ir::Operation *create(ANeuralNetworksOperationType, const OperationFactory::Param ¶m,
53 onert::ir::Operands &operands);
54 // TODO add "register" method for separating registration, possibly supporting custom-ops
57 std::unordered_map<ANeuralNetworksOperationType, Generator> _map;
60 #endif // __OPERATION_FACTORY_H__