CreateInputs
Applicability
Product |
Supported or Not |
|---|---|
√ |
|
√ |
|
√ |
|
√ |
|
√ |
Function Usage
Creates a specified number of input nodes.
Prototype
- Create a specified number of input nodes and return an array, which is applicable to structured binding during compilation.
template <size_t inputs_num> std::array<EsTensorHolder, inputs_num> CreateInputs(size_t start_index = 0)
- Create a specified number of input nodes and return a container, which is applicable to dynamic binding at run time.
1std::vector<EsTensorHolder> CreateInputs(size_t inputs_num, size_t start_index = 0)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
inputs_num |
Input |
Number of input nodes. |
start_index |
Input |
Start index of the input node. If the value is not 0, other input nodes have been created. The index of the input node should start from 0 and increase consecutively. |
Returns
Parameter |
Type |
Description |
|---|---|---|
- |
std::array<EsTensorHolder, inputs_num> |
Array of created input tensor holders. |
- |
std::vector<EsTensorHolder> |
Container of the input tensor holder. |
Constraints
None
Examples
- Create a specified number of input nodes and return an array, which is applicable to structured binding during compilation.
//1. Create a graph builder (EsGraphBuilder). EsGraphBuilder builder("graph_name"); // 2. Add two input nodes and use the structured binding of C++17 to bind data0 and data1. EsTensorHolder [data0, data1] = builder.CreateInputs<2>(); - Create a specified number of input nodes and return a container, which is applicable to dynamic binding at run time.
1 2 3 4
//1. Create a graph builder (EsGraphBuilder). EsGraphBuilder builder("graph_name"); // 2. Add two input nodes. std::vector<EsTensorHolder> inputs = builder.CreateInputs(2);
Parent topic: EsGraphBuilder