ONE - On-device Neural Engine
Loading...
Searching...
No Matches
OpPrinter.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2018 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
17#ifndef __TFLDUMP_OPPRINTER_H__
18#define __TFLDUMP_OPPRINTER_H__
19
20#include <mio/tflite/schema_generated.h>
21
22#include <ostream>
23#include <map>
24
25namespace tfldump
26{
27
29{
30public:
31 virtual void options(const tflite::Operator *, std::ostream &) const {};
32};
33
35{
36public:
38
39public:
40 const OpPrinter *lookup(tflite::BuiltinOperator op) const
41 {
42 if (_op_map.find(op) == _op_map.end())
43 return nullptr;
44
45 return _op_map.at(op).get();
46 }
47
48public:
50 {
51 static OpPrinterRegistry me;
52 return me;
53 }
54
55private:
56 std::map<tflite::BuiltinOperator, std::unique_ptr<OpPrinter>> _op_map;
57};
58
59} // namespace tfldump
60
61#endif // __TFLDUMP_OPPRINTER_H__
virtual void options(const tflite::Operator *, std::ostream &) const
Definition OpPrinter.h:31
static OpPrinterRegistry & get()
Definition OpPrinter.h:49
const OpPrinter * lookup(tflite::BuiltinOperator op) const
Definition OpPrinter.h:40
Definition Dump.h:25