#include <NNPkg.h>
Definition at line 81 of file NNPkg.h.
◆ NNPkg() [1/4]
onert::ir::NNPkg::NNPkg |
( |
| ) |
|
|
default |
◆ NNPkg() [2/4]
onert::ir::NNPkg::NNPkg |
( |
const NNPkg & |
obj | ) |
|
|
default |
◆ NNPkg() [3/4]
onert::ir::NNPkg::NNPkg |
( |
NNPkg && |
| ) |
|
|
default |
◆ ~NNPkg()
onert::ir::NNPkg::~NNPkg |
( |
| ) |
|
|
default |
◆ NNPkg() [4/4]
onert::ir::NNPkg::NNPkg |
( |
std::shared_ptr< Model > |
model | ) |
|
|
inline |
Definition at line 91 of file NNPkg.h.
const std::shared_ptr< Model > & model(const ModelIndex &index) const
Get model at index.
::onert::util::Index< uint16_t, ModelIndexTag > ModelIndex
References model().
◆ addEdge()
void onert::ir::NNPkg::addEdge |
( |
const IODesc & |
from, |
|
|
const IODesc & |
to |
|
) |
| |
|
inline |
Add edge between models at the end.
- Parameters
-
[in] | from | from IODesc |
[in] | to | to IODesc |
Definition at line 172 of file NNPkg.h.
173 {
174 std::cout << from << " -> " << to << std::endl;
175 _edges.
edges.insert(ModelEdge{from, to});
176 }
References onert::ir::ModelEdges::edges.
◆ addInput()
void onert::ir::NNPkg::addInput |
( |
const IODesc & |
input | ) |
|
|
inline |
Add input at the end.
- Parameters
-
[in] | input | Input IODesc to be pushed |
Definition at line 143 of file NNPkg.h.
const IODesc & input(uint32_t index) const
Get pkg_input at index.
std::vector< ir::IODesc > pkg_inputs
References input(), and onert::ir::ModelEdges::pkg_inputs.
◆ addOutput()
void onert::ir::NNPkg::addOutput |
( |
const IODesc & |
output | ) |
|
|
inline |
Add output at the end.
- Parameters
-
[in] | output | Output IODesc to be pushed |
Definition at line 164 of file NNPkg.h.
const IODesc & output(uint32_t index) const
Get pkg_output at index.
std::vector< ir::IODesc > pkg_outputs
References output(), and onert::ir::ModelEdges::pkg_outputs.
◆ changeInputShape()
void onert::ir::NNPkg::changeInputShape |
( |
uint32_t |
index, |
|
|
const ir::Shape & |
new_shape |
|
) |
| |
|
inline |
Definition at line 268 of file NNPkg.h.
269 {
270 if (_models.size() == 1)
271 {
273 auto const operand_index =
graph->getInputs().at(index);
274 graph->changeShape(operand_index, new_shape);
275 return;
276 }
277
278 auto const &desc =
input(index);
279 auto graph =
model(std::get<ModelIndex>(desc))->primary_subgraph();
280 auto const operand_index =
graph->getInputs().at(std::get<IOIndex>(desc).value());
281 graph->changeShape(operand_index, new_shape);
282 }
std::shared_ptr< Model > primary_model() const
References input(), model(), and primary_model().
◆ input() [1/2]
IODesc & onert::ir::NNPkg::input |
( |
uint32_t |
index | ) |
|
|
inline |
Get pkg_input at index.
- Parameters
-
[in] | index | Index of pkg_input to be returned |
- Returns
- IODesc at index
Definition at line 137 of file NNPkg.h.
loco::GraphInputIndex index(const TFPlaceholder *node)
References onert::ir::ModelEdges::pkg_inputs.
◆ input() [2/2]
const IODesc & onert::ir::NNPkg::input |
( |
uint32_t |
index | ) |
const |
|
inline |
◆ inputInfo()
const OperandInfo & onert::ir::NNPkg::inputInfo |
( |
uint32_t |
index | ) |
const |
|
inline |
Get model input info.
Definition at line 235 of file NNPkg.h.
236 {
237 if (_models.size() == 1)
238 {
240 auto const operand_index =
graph->getInputs().at(index);
241 return graph->operands().at(operand_index).info();
242 }
243
244 auto const &desc =
input(index);
245 auto const graph =
model(std::get<ModelIndex>(desc))->primary_subgraph();
246 auto const operand_index =
graph->getInputs().at(std::get<IOIndex>(desc).value());
247 return graph->operands().at(operand_index).info();
248 }
References input(), model(), and primary_model().
◆ inputSize()
uint32_t onert::ir::NNPkg::inputSize |
( |
| ) |
const |
|
inline |
◆ model() [1/2]
std::shared_ptr< Model > & onert::ir::NNPkg::model |
( |
const ModelIndex & |
index | ) |
|
|
inline |
Get model at index.
- Parameters
-
[in] | index | Index of the model to be returned |
- Returns
- Model at index
Definition at line 122 of file NNPkg.h.
122{ return _models.at(index); }
◆ model() [2/2]
const std::shared_ptr< Model > & onert::ir::NNPkg::model |
( |
const ModelIndex & |
index | ) |
const |
|
inline |
◆ model_count()
size_t onert::ir::NNPkg::model_count |
( |
| ) |
const |
|
inline |
Get the count of model.
- Returns
- the count of models
Definition at line 107 of file NNPkg.h.
107{ return _models.size(); }
◆ model_edges()
const ModelEdges & onert::ir::NNPkg::model_edges |
( |
| ) |
|
|
inline |
Get model edge set.
- Returns
- Edge set reference
Definition at line 181 of file NNPkg.h.
◆ operator=() [1/2]
NNPkg & onert::ir::NNPkg::operator= |
( |
const NNPkg & |
| ) |
|
|
default |
◆ operator=() [2/2]
◆ output() [1/2]
IODesc & onert::ir::NNPkg::output |
( |
uint32_t |
index | ) |
|
|
inline |
◆ output() [2/2]
const IODesc & onert::ir::NNPkg::output |
( |
uint32_t |
index | ) |
const |
|
inline |
◆ outputInfo()
const OperandInfo & onert::ir::NNPkg::outputInfo |
( |
uint32_t |
index | ) |
const |
|
inline |
Get model output info.
Definition at line 253 of file NNPkg.h.
254 {
255 if (_models.size() == 1)
256 {
258 auto const operand_index =
graph->getOutputs().at(index);
259 return graph->operands().at(operand_index).info();
260 }
261
262 auto const &desc =
output(index);
263 auto const graph =
model(std::get<ModelIndex>(desc))->primary_subgraph();
264 auto const operand_index =
graph->getOutputs().at(std::get<IOIndex>(desc).value());
265 return graph->operands().at(operand_index).info();
266 }
References model(), output(), and primary_model().
◆ outputSize()
uint32_t onert::ir::NNPkg::outputSize |
( |
| ) |
const |
|
inline |
◆ primary_model()
std::shared_ptr< Model > onert::ir::NNPkg::primary_model |
( |
| ) |
const |
|
inline |
◆ push()
void onert::ir::NNPkg::push |
( |
ModelIndex |
index, |
|
|
const std::shared_ptr< Model > & |
model |
|
) |
| |
|
inline |
Put model at index.
- Parameters
-
[in] | model | Model to be pushed |
[in] | index | Index where Model is to be pushed |
Definition at line 100 of file NNPkg.h.
References model().
◆ replaceModel()
void onert::ir::NNPkg::replaceModel |
( |
std::shared_ptr< Model > |
model | ) |
|
|
inline |
Replace model.
- Parameters
-
[in] | model | Model to be replaced |
TODO: Support multiple models
Definition at line 291 of file NNPkg.h.
References model().
◆ verify()
void onert::ir::NNPkg::verify |
( |
void |
| ) |
|
|
inline |
Verify NNPkg.
Definition at line 187 of file NNPkg.h.
188 {
189
190
191
192
193
194
195
196
197
198
199
200 for (const auto &edge : _edges.edges)
201 {
204 {
205 throw std::runtime_error{
206 "Invalid edge information. NNPkg inputs and Edge `to` cannot be duplicated"};
207 }
208 }
209 }
References onert::ir::ModelEdges::edges, and onert::ir::ModelEdges::pkg_inputs.
The documentation for this class was generated from the following file:
- runtime/onert/core/include/ir/NNPkg.h