ONE - On-device Neural Engine
Loading...
Searching...
No Matches
Index.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 __ONERT_IR_INDEX_H__
18
#define __ONERT_IR_INDEX_H__
19
20
#include "
util/Index.h
"
21
22
#include <iomanip>
23
#include <ostream>
24
#include <sstream>
25
26
namespace
onert
27
{
28
namespace
ir
29
{
30
31
struct
OperationIndexTag;
32
using
OperationIndex
=
::onert::util::Index<uint32_t, OperationIndexTag>
;
33
34
struct
OperandIndexTag;
35
using
OperandIndex
=
::onert::util::Index<uint32_t, OperandIndexTag>
;
36
37
struct
IOIndexTag;
38
using
IOIndex
=
::onert::util::Index<uint32_t, IOIndexTag>
;
39
40
struct
SubgraphIndexTag;
41
using
SubgraphIndex
=
::onert::util::Index<uint16_t, SubgraphIndexTag>
;
42
43
struct
ModelIndexTag;
44
using
ModelIndex
=
::onert::util::Index<uint16_t, ModelIndexTag>
;
45
46
struct
OriginIndexTag;
47
using
OriginIndex
=
::onert::util::Index<uint32_t, OriginIndexTag>
;
48
49
template
<
typename
IndexType>
50
std::ostream &
_index_print_impl
(std::ostream &o,
const
std::string &prefix, IndexType index)
51
{
52
std::ostringstream oss;
53
if
(index.undefined())
54
oss << prefix << std::string(
"?"
);
55
else
56
oss << prefix << index.value();
57
return
o << std::right << std::setw(4) << oss.str();
58
}
59
60
inline
std::ostream &
operator<<
(std::ostream &o,
const
OperationIndex
&i)
61
{
62
return
_index_print_impl
(o,
"@"
, i);
63
}
64
65
inline
std::ostream &
operator<<
(std::ostream &o,
const
OperandIndex
&i)
66
{
67
return
_index_print_impl
(o,
"%"
, i);
68
}
69
70
inline
std::ostream &
operator<<
(std::ostream &o,
const
IOIndex
&i)
71
{
72
return
_index_print_impl
(o,
"IO"
, i);
73
}
74
75
inline
std::ostream &
operator<<
(std::ostream &o,
const
SubgraphIndex
&i)
76
{
77
return
_index_print_impl
(o,
"SUBGRAPH"
, i);
78
}
79
80
inline
std::ostream &
operator<<
(std::ostream &o,
const
ModelIndex
&i)
81
{
82
return
_index_print_impl
(o,
"MODEL"
, i);
83
}
84
85
inline
std::ostream &
operator<<
(std::ostream &o,
const
OriginIndex
&i)
86
{
87
return
_index_print_impl
(o,
""
, i);
88
}
89
}
// namespace ir
90
}
// namespace onert
91
92
#endif
// __ONERT_IR_INDEX_H__
onert::util::Index< uint32_t, OperationIndexTag >
onert::ir::operator<<
std::ostream & operator<<(std::ostream &o, const OperationIndex &i)
Definition
Index.h:60
onert::ir::_index_print_impl
std::ostream & _index_print_impl(std::ostream &o, const std::string &prefix, IndexType index)
Definition
Index.h:50
onert
Definition
CustomKernel.cc:20
Index.h
runtime
onert
core
include
ir
Index.h
Generated by
1.9.8