CalcSize
Description
Calculates the size of the memory space to be pre-allocated for ComputeNodeInfo corresponding to an operator.
The memory space of ComputeNodeInfo is tiled. The memory stores data members of ComputeNodeInfo, anchor information of input counts in the operator IR definition, tensor description of actual input and output counts in the compilation phase, and attribute information in sequence. The calculation result of this function does not contain the size of the memory space occupied by the attribute information.
Prototype
static ge::graphStatus CalcSize(const size_t ir_inputs_num, const size_t inputs_num, const size_t outputs_num, size_t &total_size)
static ge::graphStatus CalcSize(const size_t ir_inputs_num, const size_t ir_outputs_num, const size_t inputs_num, const size_t outputs_num, size_t &total_size)
Parameters
Parameter |
Input/Output |
Description |
|---|---|---|
ir_inputs_num |
Input |
Number of inputs in the operator IR prototype definition. |
ir_outputs_num |
Input |
Number of outputs in the operator IR prototype definition. |
inputs_num |
Input |
Actual number of inputs of an operator. |
outputs_num |
Input |
Actual number of outputs of an operator. |
total_size |
Output |
Total size of the memory to be pre-allocated for ComputeNodeInfo and related information, excluding the memory size of RuntimeAttrs. |
Returns
The return values are of the graphStatus type (uint32_t). The values are described as follows:
Status |
Value |
Description |
|---|---|---|
ge::GRAPH_SUCCESS |
0 |
Successful operation. |
ge::GRAPH_PARAM_INVALID |
50331649 |
Execution failure, invalid parameters, and verification failure. |
Restrictions
None
Example
auto ir_input_num = node->GetOpDesc()->GetIrInputs().size(); auto input_num = node->GetInDataNodesAndAnchors().size(); auto output_num = node->GetAllOutDataAnchorsSize(); GE_ASSERT_SUCCESS(ComputeNodeInfo::CalcSize(ir_input_num, input_num, output_num, total_size));