Mxnet Code Analysis of the--symbol chapter

Source: Internet
Author: User
Tags mxnet in python

Ver2.0:

struct Node:
Std::unique_ptr<operatorproperty> op; Node action function class, variable node pointer null
std::string name; Node name
Std::vector<dataentry> inputs; The input port of the node, including the output of the upper node, the variable node, etc.
Std::shared_ptr<symbol::node> Backward_source_node; If backward is supported, represents the next level of node in reverse computing
Std::unique_ptr<std::map<std::string, std::string> > attr;

Class Description:
1 each node corresponds to a symbol in Python, the variable symbol/action symbol
2 operation symbol should contain operation function, input symbol, output symbol, if allow backward calculation, including reverse source symbol
3 Variable symbol action function handle is null and does not support backward calculation

struct DataEntry
Std::shared_ptr<node> source; Node pointer
uint32_t index; The node index number that represents the sequence number of the DFS traversal generation

Class Symbol:
Std::vector<dataentry> Heads_;

Class Description:
1 provides an interface to the Python language symbol, which expresses symbolic calculations (network)
Each element in the 2 heads represents the output node of the current symbol, and the operand has a general output node of 1, except for the following nodes:
Batch_norm:output, Mean, var
Dropout:output, Mask
Leaky_relu:output, Mask
Lrn:output, Tmp_norm
The 3 symbolic variables generally include the output of the source symbol, and the parameters of this node (weight, bias, mask, etc.)
The Shape/type of the 4 symbolic output ndarray is generally determined by the input ndarray and the operation type.

Partial function Interface Description:
void Symbol::D fsvisit (Fvisit fvisit): implementation function fvisit Depth-first traversal access for all nodes
void Keywordargumentmismatch (): Match user input variable with internal variable, implement variable key check
int Findduplicateargs (): Iterate over the network, find the recurring variable, and return the maximum duplicate value
Std::vector<std::string> listarguments (): Traversing the network, returning all the variable nodes
Std::vector<std::string> listoutputs (): Traversing the network, returning all output nodes
Symbol operator[] (size_t index): Returning Index output node
void Compose (args, name):
1 variable nodes do not support combination operations
2 All args nodes have and only one output node
3 If the parent is an atomic symbol: All args nodes are assigned to Heads_[0].source.inputs, and the remainder is padded with default variables
4 otherwise have input and args, replace existing input nodes with args
void Tostaticgraph (Staticgraph *out_graph): Convert to Staticgraph structure

/// ===================================================================================
1 About Node
1.1 Basic units in the network structure
1.2 includes the operation entrance, the unique identifier, the input list, if it is the reverse pass node, the Backward_source_node points to the corresponding forward node
1.3 Variable node action handle is empty, forward pass node Backward_source_node is null
1.4 Add the Atomic property, which is a non variable node with no input parameters added. For the convenience of practical application, no practical significance

2 about Symbol
2.1 Each symbol maintains an output queue container, and the container size is determined by numoutputs (), where the first output variable is the transfer variable (the next node output variable) in the network and the other variable as the auxiliary variable for the reverse gradient calculation
2.2 For all symbols containing operations, numvisibleoutputs = 1, which supports only single output links (other outputs are only auxiliary variables for reverse delivery)
2.3 symbol compose, combining input output to operation (not supporting variable symbols)


=============================================================================================================== ===================

Ver1.0


struct node:std::unique_ptr<operatorproperty> op; Node action function class, variable node pointer null
std::string name; Node name
Std::vector<dataentry> inputs; The input port of the node, including the output of the upper node, the variable node, etc.
Std::shared_ptr<symbol::node> Backward_source_node; If backward is supported, represents the next level of node in reverse computing
Std::unique_ptr<std::map<std::string, std::string> > attr;

Class Description:
1 each node corresponds to a symbol in Python, the variable symbol/action symbol
2 operation symbol should contain operation function, input symbol, output symbol, if allow backward calculation, including reverse source symbol
3 Variable symbol action function handle is null and does not support backward calculation
/// ------------------------------------------------------------------------------------------------------------ --------------
struct DataEntry
Std::shared_ptr<node> source; Node pointer
uint32_t index; The node index number that represents the sequence number of the DFS traversal generation


/// ------------------------------------------------------------------------------------------------------------ --------------
Class Symbol:
Std::vector<dataentry> Heads_;

Class Description:
1 provides an interface to the Python language symbol, which expresses symbolic calculations (network)
Each element in the 2 heads represents the output node of the current symbol, and the operand has a general output node of 1, except for the following nodes:
Batch_norm:output, Mean, var
Dropout:output, Mask
Leaky_relu:output, Mask
Lrn:output, Tmp_norm
The 3 symbolic variables generally include the output of the source symbol, and the parameters of this node (weight, bias, mask, etc.)
The Shape/type of the 4 symbolic output ndarray is generally determined by the input ndarray and the operation type.

Partial function Interface Description:
void Symbol::D fsvisit (Fvisit fvisit): implementation function fvisit Depth-first traversal access for all nodes
void Keywordargumentmismatch (): Match user input variable with internal variable, implement variable key check
int Findduplicateargs (): Iterate over the network, find the recurring variable, and return the maximum duplicate value
Std::vector<std::string> listarguments (): Traversing the network, returning all the variable nodes
Std::vector<std::string> listoutputs (): Traversing the network, returning all output nodes
Symbol operator[] (size_t index): Returning Index output node
void Compose (args, name):
1 variable nodes do not support combination operations
2 All args nodes have and only one output node
3 If the parent is an atomic symbol: All args nodes are assigned to Heads_[0].source.inputs, and the remainder is padded with default variables
4 otherwise have input and args, replace existing input nodes with args
void Tostaticgraph (Staticgraph *out_graph): Convert to Staticgraph structure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.