#include <NNPkg.h>
Definition at line 83 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 93 of file NNPkg.h.
94 {
96
97
98 for (uint32_t i = 0; i <
model->primary_subgraph()->getInputs().
size(); i++)
100 for (uint32_t i = 0; i <
model->primary_subgraph()->getOutputs().
size(); i++)
102 }
const std::shared_ptr< Model > & model(const ModelIndex &index) const
Get model at index.
::onert::util::Index< uint32_t, IOIndexTag > IOIndex
::onert::util::Index< uint16_t, ModelIndexTag > ModelIndex
std::vector< ir::IODesc > pkg_outputs
std::vector< ir::IODesc > pkg_inputs
References model(), onert::ir::ModelEdges::pkg_inputs, onert::ir::ModelEdges::pkg_outputs, and size.
◆ addEdge()
| void onert::ir::NNPkg::addEdge |
( |
const IODesc & |
from, |
|
|
const IODesc & |
to |
|
) |
| |
|
inline |
◆ addInput()
| void onert::ir::NNPkg::addInput |
( |
const IODesc & |
input | ) |
|
|
inline |
◆ addOutput()
| void onert::ir::NNPkg::addOutput |
( |
const IODesc & |
output | ) |
|
|
inline |
◆ changeInputShape() [1/2]
Definition at line 310 of file NNPkg.h.
311 {
312 if (_models.size() == 1)
313 {
315 auto const operand_index =
graph->getInputs().at(index);
316 graph->changeShape(operand_index, new_shape);
317 return;
318 }
319
320 auto const &desc =
input(index);
321 auto graph =
model(std::get<ModelIndex>(desc))->primary_subgraph();
322 auto const operand_index =
graph->getInputs().at(std::get<IOIndex>(desc).value());
323 graph->changeShape(operand_index, new_shape);
324 }
std::shared_ptr< Model > primary_model() const
References input(), model(), and primary_model().
◆ changeInputShape() [2/2]
| void onert::ir::NNPkg::changeInputShape |
( |
SubgraphIndex |
subg_index, |
|
|
uint32_t |
index, |
|
|
const ir::Shape & |
new_shape |
|
) |
| |
|
inline |
Definition at line 326 of file NNPkg.h.
327 {
328
329 assert(_models.size() == 1);
330
332 auto const operand_index =
graph->getInputs().at(index);
333 graph->changeShape(operand_index, new_shape);
334 return;
335 }
References primary_model().
◆ input() [1/2]
Get pkg_input at index.
- Parameters
-
| [in] | index | Index of pkg_input to be returned |
- Returns
- IODesc at index
Definition at line 148 of file NNPkg.h.
loco::GraphInputIndex index(const TFPlaceholder *node)
References onert::ir::ModelEdges::pkg_inputs.
◆ input() [2/2]
◆ inputInfo() [1/2]
Get model input info.
Definition at line 256 of file NNPkg.h.
257 {
258 if (_models.size() == 1)
259 {
261 auto const operand_index =
graph->getInputs().at(index);
262 return graph->operands().at(operand_index).info();
263 }
264
265 auto const &desc =
input(index);
266 auto const graph =
model(std::get<ModelIndex>(desc))->primary_subgraph();
267 auto const operand_index =
graph->getInputs().at(std::get<IOIndex>(desc).value());
268 return graph->operands().at(operand_index).info();
269 }
References input(), model(), and primary_model().
◆ inputInfo() [2/2]
Definition at line 271 of file NNPkg.h.
272 {
273
274 assert(_models.size() == 1);
275
277 auto const operand_index =
graph->getInputs().at(index);
278 return graph->operands().at(operand_index).info();
279 }
References primary_model().
◆ inputSize() [1/2]
| uint32_t onert::ir::NNPkg::inputSize |
( |
| ) |
const |
|
inline |
◆ inputSize() [2/2]
| uint32_t onert::ir::NNPkg::inputSize |
( |
SubgraphIndex |
subg_index | ) |
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 133 of file NNPkg.h.
133{ 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 118 of file NNPkg.h.
118{ return _models.size(); }
◆ model_edges()
| const ModelEdges & onert::ir::NNPkg::model_edges |
( |
| ) |
|
|
inline |
Get model edge set.
- Returns
- Edge set reference
Definition at line 188 of file NNPkg.h.
◆ operator=() [1/2]
| NNPkg & onert::ir::NNPkg::operator= |
( |
const NNPkg & |
| ) |
|
|
default |
◆ operator=() [2/2]
◆ output() [1/2]
◆ output() [2/2]
◆ outputInfo() [1/2]
Get model output info.
Definition at line 284 of file NNPkg.h.
285 {
286 if (_models.size() == 1)
287 {
289 auto const operand_index =
graph->getOutputs().at(index);
290 return graph->operands().at(operand_index).info();
291 }
292
293 auto const &desc =
output(index);
294 auto const graph =
model(std::get<ModelIndex>(desc))->primary_subgraph();
295 auto const operand_index =
graph->getOutputs().at(std::get<IOIndex>(desc).value());
296 return graph->operands().at(operand_index).info();
297 }
References model(), output(), and primary_model().
◆ outputInfo() [2/2]
Definition at line 299 of file NNPkg.h.
300 {
301
302 assert(_models.size() == 1);
303
305
306 auto const operand_index =
graph->getOutputs().at(index);
307 return graph->operands().at(operand_index).info();
308 }
References primary_model().
◆ outputSize() [1/2]
| uint32_t onert::ir::NNPkg::outputSize |
( |
| ) |
const |
|
inline |
◆ outputSize() [2/2]
| uint32_t onert::ir::NNPkg::outputSize |
( |
SubgraphIndex |
subg_index | ) |
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 111 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 344 of file NNPkg.h.
References model().
◆ verify()
| void onert::ir::NNPkg::verify |
( |
void |
| ) |
|
|
inline |
Verify NNPkg.
Definition at line 194 of file NNPkg.h.
195 {
196
197
198
199
200
201
202
203
204
205
206
207 for (const auto &edge : _edges.edges)
208 {
211 {
212 throw std::runtime_error{
213 "Invalid edge information. NNPkg inputs and Edge `to` cannot be duplicated"};
214 }
215 }
216 }
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