-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Many thanks for the updates @Ishitori. Apart from low-level suggestion, would want this tutorial to automatically determine context. And would add a short section on how to obtain a Symbol from Gluon Block to give the reader a better understanding of how these APIs work together.
docs/tutorials/basic/symbol.md
Outdated
@@ -71,20 +42,14 @@ To complete this tutorial, we need: | |||
``` | |||
pip install jupyter | |||
``` | |||
- GPUs - A section of this tutorial uses GPUs. If you don't have GPUs on your machine, simply | |||
set the variable gpu_device to mx.cpu(). | |||
- GPUs (optional). A section of this tutorial uses GPUs. If you don't have GPUs on your machine, simply set the variable `gpu_device` to `mx.cpu()`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should automatically change context depending on whether a GPU is available or not.
docs/tutorials/basic/symbol.md
Outdated
Operators take symbol (or NDArray) as inputs and might also additionally accept | ||
other hyperparameters such as the number of hidden neurons (*num_hidden*) or the | ||
activation type (*act_type*) and produce the output. | ||
Each symbol takes a unique string name. `NDArray` and `Symbol` both represent a single tensor. *Operators* represent the computation between tensors. Operators take `symbol` or `NDArray` as inputs and might also additionally accept other hyperparameters such as the number of hidden neurons (`num_hidden`) or the activation type (`act_type`) and produce the output. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
symbol
-> Symbol
. Change other cases (but not non-code versions).
@@ -188,14 +144,9 @@ composed = net2(data2=net1, name='composed') | |||
composed.list_arguments() | |||
``` | |||
|
|||
In this example, *net2* is used as a function to apply to an existing symbol *net1*, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
netx -> netx
(for 1 and 2)
docs/tutorials/basic/symbol.md
Outdated
Finally, we can obtain the whole network by chaining multiple inception | ||
modules. See a complete example | ||
[here](https://github.com/dmlc/mxnet/blob/master/example/image-classification/symbols/inception-bn.py). | ||
Finally, we can obtain the whole network by chaining multiple inception modules. See a [complete example](https://github.com/dmlc/mxnet/blob/master/example/image-classification/symbols/inception-bn.py). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Undo this change. Or if you wanted a larger link could include 'complete example' in the link.
docs/tutorials/basic/symbol.md
Outdated
# infers output type given the type of input arguments | ||
arg_type, out_type, _ = c.infer_type(a='float32', b='float32') | ||
{'input' : dict(zip(arg_name, arg_shape)), | ||
'output' : dict(zip(out_name, out_shape))} | ||
'output' : dict(zip(out_name, out_shape))} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would say the original style is better.
docs/tutorials/basic/symbol.md
Outdated
are inputs/outputs of operators. We can either serialize a `Symbol` object by | ||
using `pickle`, or by using `save` and `load` methods directly as we discussed in | ||
[NDArray tutorial](http://mxnet.io/tutorials/basic/ndarray.html#serialize-from-to-distributed-filesystems). | ||
Logically symbols correspond to NDArrays. They both represent a tensor. They both are inputs/outputs of operators. We can either serialize a `Symbol` object by using `pickle`, or by using `save` and `load` methods directly as it is explained in [NDArray tutorial](http://mxnet.io/tutorials/basic/ndarray.html#serialize-from-to-distributed-filesystems). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explained in [NDArray tutorial] -> explained in [this NDArray tutorial]
docs/tutorials/basic/symbol.md
Outdated
using any front-end language such as Python. It often makes the developing and | ||
debugging much easier. To implement an operator in Python, refer to | ||
[How to create new operators](http://mxnet.io/faq/new_op.html). | ||
Most operators such as [mx.sym.Convolution](https://mxnet.incubator.apache.org/api/python/symbol/symbol.html#mxnet.symbol.Convolution) and [mx.sym.Reshape](https://mxnet.incubator.apache.org/api/python/symbol/symbol.html#mxnet.symbol.reshape) are implemented in C++ for better performance. MXNet also allows users to write new operators using any front-end language such as Python. It often makes the developing and debugging much easier. To implement an operator in Python, refer to [How to create new operators](http://mxnet.io/faq/new_op.html). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove the in-line code rendering? (e.g. code
)? Can still add a link to the in-line code.
docs/tutorials/basic/symbol.md
Outdated
ex = b.bind(ctx=mx.cpu(), args={'a':data, 'b':data}) | ||
ex.forward() | ||
ex.outputs[0].asnumpy() | ||
``` | ||
|
||
### Weight tying | ||
|
||
You can use same principle to tie weights of different layers. In the example below two `FullyConnected` layers share same weights and biases, but process different data. Find a full example below. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you explain a little more about where to look or what's going on? It's quite a long code block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Useful example though!
docs/tutorials/basic/symbol.md
Outdated
|
||
- Learn how to [use Module API to train neural network](https://mxnet.incubator.apache.org/versions/master/tutorials/basic/module.html) | ||
|
||
- Explore ways you can [load data from disk](https://mxnet.incubator.apache.org/versions/master/tutorials/basic/data.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would link to a hybridization tutorial instead.
docs/tutorials/basic/symbol.md
Outdated
|
||
## Recommended Next Steps | ||
|
||
- Learn how to [use Module API to train neural network](https://mxnet.incubator.apache.org/versions/master/tutorials/basic/module.html) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add . at end of sentences.
Cheers for the updates. I think the weight tying example description should go above the code block. Or even better can the code be broken into some sections, and the descriptions be inserted at the correct places. It's a long example. |
Yep, looks a lot better, thanks. LGTM. |
@mxnet-label-bot add [pr-awaiting-review] |
Description
Revise and improve Symbol tutorial. Added section on weight tying and more links to the documentation.