AddOperation

Description

  • Adds an operator to a graph.
  • Creates and adds an operator to a graph.

Definition

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
virtual Status AddOperation (Operation *operation, const SVector< std::string > &inTensorNames, const SVector< std::string > &outTensorNames)=0;

template <class OpParam>
Status AddOperation(const OpParam &opParam, const SVector<std::string> &inTensorNames, const SVector< std::string > &outTensorNames)
{
    Operation *operation = nullptr;
    Status st = CreateOperation(opParam, &operation);
    if (st != NO_ERROR) {
        return st;
    }
    st =  AddOperation(operation, inTensorNames, outTensorNames);
    if (st != NO_ERROR) {
        if (operation != nullptr) {
            DestroyOperation(operation);
        }
    }
    return st;
}

Members

Member

Description

opParam

Operator parameter to be added

inTensorNames

Name of the input tensor of the operator to be added

outTensorNames

Name of the output tensor of the operator to be added

Returns

Status. If the setting is successful, NO_ERROR is returned.