Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

survey on computation graph #4398

Merged
merged 5 commits into from
Oct 24, 2017
Merged

Conversation

QiJune
Copy link
Member

@QiJune QiJune commented Sep 26, 2017

Our Block(NetOp) is now derived from OperatorBase, and a NetOp can nest NetOp arbitrarily. However, when I dive into Mxnet/TensorFlow/Dynet, I find that there will be only one Graph in a topology. Users write symbolic code to configure their topology. The symbolic concepts in Mxnet/TensorFlow/Dynet are Symbol/Tensor/Expression.
In if-else operator, we will have nesting Block, but in most cases, we should not allow nesting Block. fc_op should not be an independent block, and both forward and backward part operators should be in one Block, not two Block.

@QiJune
Copy link
Member Author

QiJune commented Sep 26, 2017

We have put forward similar solution now in #4052, close this survey.

@QiJune QiJune closed this Sep 26, 2017
用户配置网络的核心概念是`Symbol`,Mxnet在C++端实现了`Symbol`,并通过CAPI暴露到Python端。在这里可以参考Mxnet中对`Symbol`的注释:

`Symbol` is help class used to represent the operator node in Graph.
`Symbol` acts as an interface for building graphs from different components like Variable, Functor and Group. `Symbol` is also exported to python front-end (while Graph is not) to enable quick test and deployment. Conceptually, symbol is the final operation of a graph and thus including all the information required (the graph) to evaluate its output value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Curious what is Group used for?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Group is like a Concat Operator, just put some symbol together, and use a symbol to represent them.

@QiJune QiJune reopened this Sep 26, 2017
```python
def get_symbol(num_classes=10, **kwargs):
data = mx.symbol.Variable('data')
data = mx.sym.Flatten(data=data)
Copy link
Member

@jacquesqiao jacquesqiao Sep 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data = mx.sym.Flatten(data=data)   

==>

data = mx.symbol.Flatten(data=data)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


### TensorFlow

用户配置网络的核心概念是`Tensor`,在Python端定义了`Tensor`,在这里可以直接参考TensorFlow对Tensor的注释:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

another important concept is Node in Graph.

The graph of tensorflow is constructed by a list of Node, Tensor is the input/output of the Graph.

Copy link
Member Author

@QiJune QiJune Sep 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, Symbol/Tensor/Expression are user-end, and they contain all information(mainly data dependency) and can be parsed to Graph-like(Node and Edge) structure.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

o,和symbol对应的概念是Tensor

Copy link
Member Author

@QiJune QiJune Sep 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Symbol/Tensor/Expression ----> Graph(Nodes and Edges)

@@ -0,0 +1,232 @@
## Survey on Graph

Neural network framework often provides Symbolic api for users to write network topology conveniently. This doc manily focus on Symbolic api in most popular neural network frameworks, and try to find out how to parse Symbolic configuration to a portable file, such as protobuf or json.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe change all "Symbolic" to "symbolic", and all "api" to "API".
Please check all English text with www.grammarly.com

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


The core concept of Symbolic api is `Tensor`. Tensorflow defines `Tensor` in Python. Please refer to the comments in TensorFlow:

A `Tensor` is a symbolic handle to one of the outputs of an `Operation`. It does not hold the values of that operation's output, but instead provides a means of computing those values in a TensorFlow @{tf.Session}.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't quite understand what the "@{tf.Session}" syntax means, maybe use [session](link-to-session-doc).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@helinwang helinwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@tonyyang-svail
Copy link

@QiJune @helinwang @jacquesqiao this PR lacks activity. Either close or merge it.

@helinwang helinwang merged commit 046b815 into PaddlePaddle:develop Oct 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants