24 #ifndef NNVM_OP_ATTR_TYPES_H_ 25 #define NNVM_OP_ATTR_TYPES_H_ 31 #include <unordered_map> 91 template<
typename AttrType>
93 std::vector<AttrType> *in_attrs,
94 std::vector<AttrType> *out_attrs)>;
104 std::unordered_map<std::string, std::string>
159 std::vector<std::pair<int, int> > (
const NodeAttrs& attrs)>;
194 using FGradient = std::function<std::vector<NodeEntry>(
196 const std::vector<NodeEntry>& out_grads)>;
231 std::vector<Layout> *ilayouts,
232 const std::vector<Layout> *last_ilayouts,
233 std::vector<Layout> *olayouts)>;
249 #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:105
std::function< std::vector< NodeEntry >(const ObjectPtr &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:196
std::function< std::vector< std::string >(const NodeAttrs &attrs)> FListInputNames
Return list of input arguments names of each operator.
Definition: op_attr_types.h:51
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:159
The attributes of the current operation node. Usually are additional parameters like axis...
Definition: node.h:119
bool TIsGhost
Whether this op is a ghost node. If TIsGhost is true:
Definition: op_attr_types.h:147
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:117
Graph node data structure.
std::function< std::vector< uint32_t >(const NodeAttrs &attrs)> FMutateInputs
Check whether operator will mutate k-th input.
Definition: op_attr_types.h:84
std::function< std::vector< std::string >(const NodeAttrs &attrs)> FListOutputNames
Return list of output arguments names of each operator.
Definition: op_attr_types.h:74
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:171
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:183
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:94
FInferNodeEntryAttr< int > FInferType
Type inference function. Update the type given the known type information.
Definition: op_attr_types.h:126
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:245
std::function< uint32_t(const NodeAttrs &attrs)> FNumVisibleOutputs
Return number of visible outputs by the user.
Definition: op_attr_types.h:63
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:233
bool TIsBackward
Whether this op is an explicit backward operator, If TIsBackward is true:
Definition: op_attr_types.h:136
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).
std::function< void(const NodeAttrs &attrs, ObjectPtr var, const int index)> FSetInputVarAttrOnCompose
Set the attributes of input variable. Usually used for setting initialization or weight decay...
Definition: op_attr_types.h:208
std::shared_ptr< Node > ObjectPtr
we always used ObjectPtr for a reference pointer to the node, so this alias can be changed in case...
Definition: node.h:48
Configuration of nnvm as well as basic data structure.