THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
parseAttrs
- takes a set of key/value pairs for attributes and gives users an opportunity to validate the attributes passed to their custom operator.int parseAttrs(std::map<std::string,std::string> attrs,
int* num_in,
int* num_out);- Inputs: the map of attributes passed to the operator from the user
- Outputs: num_in, num_out - the number of input/output arrays required for this operator
- returns 1 if success, or zero if failure
inferType
- performs type inference for this operatorint inferType(std::map<std::string,std::string> attrs,
std::vector<int> &intypes,
std::vector<int> &outtypes);- Inputs: the map of attributes
- Inputs/Outputs: intypes, outtypes - the list of input/output types that should be inferred. Values of of -1 should be defined by this operator as a specific type
- returns 1 if success, or zero if failure
inferShape
- performs shape inference for this operatorint inferShape(std::map<std::string,std::string> attrs,
std::vector<std::vector<unsigned int>> &inshapes,
std::vector<std::vector<unsigned int>> &outshapes);- Inputs: the map of attributes
- Inputs: inshapes - the shapes of the input arrays
- Outputs: outshapes - the shapes of output arrays
fcompute
- performs computation of this operatorint myFCompute(std::map<std::string,std::string> attrs,
std::vector<MXTensor> inputs,
std::vector<MXTensor> outputs);- Inputs: the map of attributes
- Input data: inputs, input tensors
- Output data: outputs, output tensors
...
REGISTER_OP
- registers the operator in the libraryREGISTER_OP(sam)
.setFCompute_cpu(myFCompute)
.setParseAttrs(parseAttrs)
.setInferType(inferType)
.setInferShape(inferShape);REGISTER_OP
- macro that defines an custom operator object with given namesetFCompute_cpu
- sets the FCompute function for CPU contextsetFCompute_gpu
- sets the FCompute function for GPU contextsetParseAttrs
- sets the parse attributes functionsetInferType
- sets the infer types functionsetInferShape
- sets the infer shapes function
...