#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 |
Add edge between models at the end.
- Parameters
-
[in] | from | from IODesc |
[in] | to | to IODesc |
Definition at line 183 of file NNPkg.h.
184 {
185 std::cout << from << " -> " << to << std::endl;
186 _edges.
edges.insert(ModelEdge{from, to});
187 }
References onert::ir::ModelEdges::edges.
◆ 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 314 of file NNPkg.h.
315 {
316 if (_models.size() == 1)
317 {
319 auto const operand_index =
graph->getInputs().at(index);
320 graph->changeShape(operand_index, new_shape);
321 return;
322 }
323
324 auto const &desc =
input(index);
325 auto graph =
model(std::get<ModelIndex>(desc))->primary_subgraph();
326 auto const operand_index =
graph->getInputs().at(std::get<IOIndex>(desc).value());
327 graph->changeShape(operand_index, new_shape);
328 }
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 330 of file NNPkg.h.
331 {
332
333 assert(_models.size() == 1);
334
336 auto const operand_index =
graph->getInputs().at(index);
337 graph->changeShape(operand_index, new_shape);
338 return;
339 }
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 260 of file NNPkg.h.
261 {
262 if (_models.size() == 1)
263 {
265 auto const operand_index =
graph->getInputs().at(index);
266 return graph->operands().at(operand_index).info();
267 }
268
269 auto const &desc =
input(index);
270 auto const graph =
model(std::get<ModelIndex>(desc))->primary_subgraph();
271 auto const operand_index =
graph->getInputs().at(std::get<IOIndex>(desc).value());
272 return graph->operands().at(operand_index).info();
273 }
References input(), model(), and primary_model().
◆ inputInfo() [2/2]
Definition at line 275 of file NNPkg.h.
276 {
277
278 assert(_models.size() == 1);
279
281 auto const operand_index =
graph->getInputs().at(index);
282 return graph->operands().at(operand_index).info();
283 }
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 192 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 288 of file NNPkg.h.
289 {
290 if (_models.size() == 1)
291 {
293 auto const operand_index =
graph->getOutputs().at(index);
294 return graph->operands().at(operand_index).info();
295 }
296
297 auto const &desc =
output(index);
298 auto const graph =
model(std::get<ModelIndex>(desc))->primary_subgraph();
299 auto const operand_index =
graph->getOutputs().at(std::get<IOIndex>(desc).value());
300 return graph->operands().at(operand_index).info();
301 }
References model(), output(), and primary_model().
◆ outputInfo() [2/2]
Definition at line 303 of file NNPkg.h.
304 {
305
306 assert(_models.size() == 1);
307
309
310 auto const operand_index =
graph->getOutputs().at(index);
311 return graph->operands().at(operand_index).info();
312 }
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 348 of file NNPkg.h.
References model().
◆ verify()
void onert::ir::NNPkg::verify |
( |
void |
| ) |
|
|
inline |
Verify NNPkg.
Definition at line 198 of file NNPkg.h.
199 {
200
201
202
203
204
205
206
207
208
209
210
211 for (const auto &edge : _edges.edges)
212 {
215 {
216 throw std::runtime_error{
217 "Invalid edge information. NNPkg inputs and Edge `to` cannot be duplicated"};
218 }
219 }
220 }
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