mxnet
|
Operator structure. More...
#include <op.h>
Public Member Functions | |
Op & | describe (const std::string &descr) |
setter function during registration Set the description of operator More... | |
Op & | add_argument (const std::string &name, const std::string &type, const std::string &description) |
Add argument information to the function. More... | |
Op & | add_arguments (const std::vector< ParamFieldInfo > &args) |
Append list if arguments to the end. More... | |
Op & | set_num_inputs (uint32_t n) |
Set the num_inputs. More... | |
Op & | set_support_level (uint32_t level) |
Set the support level of op. More... | |
Op & | set_num_inputs (std::function< uint32_t(const NodeAttrs &attr)> fn) |
Set the get_num_outputs function. More... | |
Op & | set_num_outputs (uint32_t n) |
Set the num_outputs. More... | |
Op & | set_num_outputs (std::function< uint32_t(const NodeAttrs &attr)> fn) |
Set the get_num_outputs function. More... | |
Op & | set_attr_parser (std::function< void(NodeAttrs *attrs)> fn) |
Set the attr_parser function. More... | |
template<typename ValueType > | |
Op & | set_attr (const std::string &attr_name, const ValueType &value, int plevel=10) |
Register additional attributes to operator. More... | |
Op & | add_alias (const std::string &alias) |
Add another alias to this operator. The same Op can be queried with Op::Get(alias) More... | |
Op & | include (const std::string &group_name) |
Include all the attributes from an registered op group. More... | |
Static Public Member Functions | |
static const Op * | Get (const std::string &op_name) |
Get an Op for a given operator name. Will raise an error if the op has not been registered. More... | |
template<typename ValueType > | |
static const OpMap< ValueType > & | GetAttr (const std::string &attr_name) |
Get additional registered attribute about operators. If nothing has been registered, an empty OpMap will be returned. More... | |
Public Attributes | |
std::string | name |
name of the operator More... | |
std::string | description |
detailed description of the operator This can be used to generate docstring automatically for the operator. More... | |
std::vector< ParamFieldInfo > | arguments |
uint32_t | num_inputs = 1 |
number of inputs to the operator, -1 means it is variable length When get_num_inputs is presented, the number will be decided by get_num_inputs instead. More... | |
uint32_t | num_outputs = 1 |
number of outputs of the operator When get_num_outputs is presented. The number of outputs will be decided by get_num_outputs function More... | |
uint32_t | support_level = 10 |
support level of the operator, The lower the more priority it contains. This is in analogies to BLAS levels. More... | |
std::function< uint32_t(const NodeAttrs &attrs)> | get_num_outputs = nullptr |
get number of outputs given information about the node. More... | |
std::function< uint32_t(const NodeAttrs &attrs)> | get_num_inputs = nullptr |
get number of inputs given information about the node. More... | |
std::function< void(NodeAttrs *attrs)> | attr_parser = nullptr |
Attribute parser to parse the NodeAttrs information. More... | |
Friends | |
template<typename ValueType > | |
class | OpMap |
class | OpGroup |
class | dmlc::Registry< Op > |
Operator structure.
Besides the fields in the structure, arbitary additional information can be associated with each op. See function GetAttr for details.
Op& nnvm::Op::add_alias | ( | const std::string & | alias | ) |
Add another alias to this operator. The same Op can be queried with Op::Get(alias)
alias | The alias of the operator. |
|
inline |
Add argument information to the function.
name | Name of the argument. |
type | Type of the argument. |
description | Description of the argument. |
|
inline |
Append list if arguments to the end.
args | Additional list of arguments. |
|
inline |
setter function during registration Set the description of operator
descr | the description string. |
|
static |
|
inlinestatic |
Op& nnvm::Op::include | ( | const std::string & | group_name | ) |
Include all the attributes from an registered op group.
group_name | The name of the group. |
|
inline |
Register additional attributes to operator.
attr_name | The name of the attribute. |
value | The value to be set. |
plevel | The priority level of this set, an higher priority level attribute will replace lower priority level attribute. Must be bigger than 0. |
Cannot set with same plevel twice in the code.
ValueType | The type of the value to be set. |
Set the attr_parser function.
fn | The number of outputs to be set. |
|
inline |
Set the num_inputs.
n | The number of inputs to be set. |
Set the get_num_outputs function.
fn | The function to be set. |
|
inline |
Set the num_outputs.
n | The number of outputs to be set. |
Set the get_num_outputs function.
fn | The function to be set. |
|
inline |
Set the support level of op.
level | The support level. |
|
friend |
|
friend |
|
friend |
std::vector<ParamFieldInfo> nnvm::Op::arguments |
std::function<void(NodeAttrs* attrs)> nnvm::Op::attr_parser = nullptr |
Attribute parser to parse the NodeAttrs information.
This can help to get quick access to a parsed attribute object
std::string nnvm::Op::description |
detailed description of the operator This can be used to generate docstring automatically for the operator.
std::function<uint32_t(const NodeAttrs& attrs)> nnvm::Op::get_num_inputs = nullptr |
get number of inputs given information about the node.
attrs | The attribute of the node |
std::function<uint32_t(const NodeAttrs& attrs)> nnvm::Op::get_num_outputs = nullptr |
get number of outputs given information about the node.
attrs | The attribute of the node |
std::string nnvm::Op::name |
name of the operator
uint32_t nnvm::Op::num_inputs = 1 |
number of inputs to the operator, -1 means it is variable length When get_num_inputs is presented, the number will be decided by get_num_inputs instead.
uint32_t nnvm::Op::num_outputs = 1 |
number of outputs of the operator When get_num_outputs is presented. The number of outputs will be decided by get_num_outputs function
uint32_t nnvm::Op::support_level = 10 |
support level of the operator, The lower the more priority it contains. This is in analogies to BLAS levels.