#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.
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 174 of file NNPkg.h.
175 {
176 std::cout << from << " -> " << to << std::endl;
177 _edges.
edges.insert(ModelEdge{from, to});
178 }
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 145 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 166 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 270 of file NNPkg.h.
271 {
272 if (_models.size() == 1)
273 {
275 auto const operand_index =
graph->getInputs().at(index);
276 graph->changeShape(operand_index, new_shape);
277 return;
278 }
279
280 auto const &desc =
input(index);
281 auto graph =
model(std::get<ModelIndex>(desc))->primary_subgraph();
282 auto const operand_index =
graph->getInputs().at(std::get<IOIndex>(desc).value());
283 graph->changeShape(operand_index, new_shape);
284 }
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 139 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 237 of file NNPkg.h.
238 {
239 if (_models.size() == 1)
240 {
242 auto const operand_index =
graph->getInputs().at(index);
243 return graph->operands().at(operand_index).info();
244 }
245
246 auto const &desc =
input(index);
247 auto const graph =
model(std::get<ModelIndex>(desc))->primary_subgraph();
248 auto const operand_index =
graph->getInputs().at(std::get<IOIndex>(desc).value());
249 return graph->operands().at(operand_index).info();
250 }
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 124 of file NNPkg.h.
124{ 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 109 of file NNPkg.h.
109{ return _models.size(); }
◆ model_edges()
const ModelEdges & onert::ir::NNPkg::model_edges |
( |
| ) |
|
|
inline |
Get model edge set.
- Returns
- Edge set reference
Definition at line 183 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 255 of file NNPkg.h.
256 {
257 if (_models.size() == 1)
258 {
260 auto const operand_index =
graph->getOutputs().at(index);
261 return graph->operands().at(operand_index).info();
262 }
263
264 auto const &desc =
output(index);
265 auto const graph =
model(std::get<ModelIndex>(desc))->primary_subgraph();
266 auto const operand_index =
graph->getOutputs().at(std::get<IOIndex>(desc).value());
267 return graph->operands().at(operand_index).info();
268 }
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 102 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 293 of file NNPkg.h.
References model().
◆ verify()
void onert::ir::NNPkg::verify |
( |
void |
| ) |
|
|
inline |
Verify NNPkg.
Definition at line 189 of file NNPkg.h.
190 {
191
192
193
194
195
196
197
198
199
200
201
202 for (const auto &edge : _edges.edges)
203 {
206 {
207 throw std::runtime_error{
208 "Invalid edge information. NNPkg inputs and Edge `to` cannot be duplicated"};
209 }
210 }
211 }
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