25 #ifndef NNVM_OP_ATTR_TYPES_H_ 26 #define NNVM_OP_ATTR_TYPES_H_ 32 #include <unordered_map> 92 template<
typename AttrType>
94 std::vector<AttrType> *in_attrs,
95 std::vector<AttrType> *out_attrs)>;
105 std::unordered_map<std::string, std::string>
160 std::vector<std::pair<int, int> > (
const NodeAttrs& attrs)>;
195 using FGradient = std::function<std::vector<NodeEntry>(
197 const std::vector<NodeEntry>& out_grads)>;
232 std::vector<Layout> *ilayouts,
233 const std::vector<Layout> *last_ilayouts,
234 std::vector<Layout> *olayouts)>;
250 #endif // NNVM_OP_ATTR_TYPES_H_ std::function< std::unordered_map< std::string, std::string >(const NodeAttrs &attrs)> FGetAttrDict
Get attribute dictionary from node.
Definition: op_attr_types.h:106
std::function< void(const NodeAttrs &attrs, NodePtr var, const int index)> FSetInputVarAttrOnCompose
Set the attributes of input variable. Usually used for setting initialization or weight decay...
Definition: op_attr_types.h:209
std::function< std::vector< std::string >(const NodeAttrs &attrs)> FListInputNames
Return list of input arguments names of each operator.
Definition: op_attr_types.h:52
Graph node data structure.
std::function< std::vector< std::pair< int, int > >(const NodeAttrs &attrs)> FInplaceOption
Get possible inplace options. This function enables optimization to reuse memory of inputs in output...
Definition: op_attr_types.h:160
The attributes of the current operation node. Usually are additional parameters like axis...
Definition: node.h:120
bool TIsGhost
Whether this op is a ghost node. If TIsGhost is true:
Definition: op_attr_types.h:148
std::function< std::vector< NodeEntry >(const NodePtr &nodeptr, const std::vector< NodeEntry > &out_grads)> FGradient
Get the gradient node of the op node This function generates the backward graph of the node...
Definition: op_attr_types.h:197
FInferNodeEntryAttr< TShape > FInferShape
Shape inference function. Update the shapes given the input shape information. TShape.ndim() == 0 means the shape is still unknown.
Definition: op_attr_types.h:118
std::shared_ptr< Node > NodePtr
we always used NodePtr for a reference pointer to the node, so this alias can be changed in case...
Definition: node.h:49
std::function< std::vector< uint32_t >(const NodeAttrs &attrs)> FMutateInputs
Check whether operator will mutate k-th input.
Definition: op_attr_types.h:85
std::function< std::vector< std::string >(const NodeAttrs &attrs)> FListOutputNames
Return list of output arguments names of each operator.
Definition: op_attr_types.h:75
Data structure Tuple and TShape to store dynamic sized shapes.
std::function< std::vector< bool >(const NodeAttrs &attrs)> FInplaceIdentity
Get if the inplace option is an identity This function enables inplace optimization even when input r...
Definition: op_attr_types.h:172
std::function< std::vector< uint32_t >(const NodeAttrs &attrs)> FIgnoreInputs
Get list of inputs in the op whose content are actually not used by the operator These are dummy inpu...
Definition: op_attr_types.h:184
std::function< bool(const NodeAttrs &attrs, std::vector< AttrType > *in_attrs, std::vector< AttrType > *out_attrs)> FInferNodeEntryAttr
Inference function of certain type.
Definition: op_attr_types.h:95
FInferNodeEntryAttr< int > FInferType
Type inference function. Update the type given the known type information.
Definition: op_attr_types.h:127
std::function< std::vector< uint32_t >(const NodeAttrs &attrs)> FInputGraph
Get a list of inputs that represent graphs instead of data. Normally, input symbols are considered as...
Definition: op_attr_types.h:246
std::function< uint32_t(const NodeAttrs &attrs)> FNumVisibleOutputs
Return number of visible outputs by the user.
Definition: op_attr_types.h:64
std::function< bool(const NodeAttrs &attrs, std::vector< Layout > *ilayouts, const std::vector< Layout > *last_ilayouts, std::vector< Layout > *olayouts)> FCorrectLayout
Infer & correct function of node layout. See Layout for layout convention.
Definition: op_attr_types.h:234
bool TIsBackward
Whether this op is an explicit backward operator, If TIsBackward is true:
Definition: op_attr_types.h:137
Layout expression. The layout is composed of upper cases, lower cases and numbers, where upper case indicates a (super-)dimension and the corresponding lower case with factor size indicates the split (sub-)dimension. For example, NCHW16c can describe a 5-D tensor of [batch_size, channel, height, width, channel_block]. Here sub-dimension channel_block=16 is the split of super-dimension C (channel).
Configuration of nnvm as well as basic data structure.