TEChopra1000 commented on a change in pull request #16500: Fixing broken links
URL: https://github.com/apache/incubator-mxnet/pull/16500#discussion_r335621646
 
 

 ##########
 File path: 
docs/python_docs/python/tutorials/packages/ndarray/gotchas_numpy_in_mxnet.md
 ##########
 @@ -22,29 +22,29 @@ The goal of this tutorial is to explain some common 
misconceptions about using [
 
 ## Asynchronous and non-blocking nature of Apache MXNet
 
-Instead of using NumPy arrays Apache MXNet offers its own array implementation 
named [NDArray](https://mxnet.apache.org/api/python/ndarray/ndarray.html). 
`NDArray API` was intentionally designed to be similar to `NumPy`, but there 
are differences.
+Instead of using NumPy arrays Apache MXNet offers its own array implementation 
named [NDArray](/api/python/docs/api/ndarray/index.html). `NDArray API` was 
intentionally designed to be similar to `NumPy`, but there are differences.
 
-One key difference is in the way calculations are executed. Every `NDArray` 
manipulation in Apache MXNet is done in asynchronous, non-blocking way. That 
means, that when we write code like `c = a * b`, where both `a` and `b` are 
`NDArrays`, the function is pushed to the [Execution 
Engine](https://mxnet.apache.org/architecture/overview.html#execution-engine), 
which starts the calculation. The function immediately returns back, and the  
user thread can continue execution, despite the fact that the calculation may 
not have been completed yet. 
+One key difference is in the way calculations are executed. Every `NDArray` 
manipulation in Apache MXNet is done in asynchronous, non-blocking way. That 
means, that when we write code like `c = a * b`, where both `a` and `b` are 
`NDArrays`, the function is pushed to the [Execution 
Engine](/api/architecture/overview.html#execution-engine), which starts the 
calculation. The function immediately returns back, and the  user thread can 
continue execution, despite the fact that the calculation may not have been 
completed yet.
 
-`Execution Engine` builds the computation graph which may reorder or combine 
some calculations, but it honors dependency order: if there are other 
manipulation with `c` done later in the code, the `Execution Engine` will start 
doing them once the result of `c` is available. We don't need to write 
callbacks to start execution of subsequent code - the `Execution Engine` is 
going to do it for us. 
+`Execution Engine` builds the computation graph which may reorder or combine 
some calculations, but it honors dependency order: if there are other 
manipulation with `c` done later in the code, the `Execution Engine` will start 
doing them once the result of `c` is available. We don't need to write 
callbacks to start execution of subsequent code - the `Execution Engine` is 
going to do it for us.
 
-To get the result of the computation we only need to access the resulting 
variable, and the flow of the code will be blocked until the computation 
results are assigned to the resulting variable. This behavior allows to 
increase code performance while still supporting imperative programming mode. 
+To get the result of the computation we only need to access the resulting 
variable, and the flow of the code will be blocked until the computation 
results are assigned to the resulting variable. This behavior allows to 
increase code performance while still supporting imperative programming mode.
 
-Refer to the [intro tutorial to 
NDArray](https://mxnet.apache.org/tutorials/basic/ndarray.html), if you are new 
to Apache MXNet and would like to learn more how to manipulate NDArrays.
+Refer to the [intro tutorial to 
NDArray](/api/python/docs/tutorials/packages/ndarray/index.html), if you are 
new to Apache MXNet and would like to learn more how to manipulate NDArrays.
 
 ## Converting NDArray to NumPy Array blocks calculation
 
-Many people are familiar with NumPy and flexible doing tensor manipulations 
using it. `NDArray API` offers  a convinient [.asnumpy() 
method](https://mxnet.apache.org/api/python/ndarray/ndarray.html#mxnet.ndarray.NDArray.asnumpy)
 to cast `nd.array` to `np.array`. However, by doing this cast and using 
`np.array` for calculation, we cannot use all the goodness of `Execution 
Engine`. All manipulations done on `np.array` are blocking. Moreover, the cast 
to `np.array` itself is a blocking operation (same as 
[.asscalar()](https://mxnet.apache.org/api/python/ndarray/ndarray.html#mxnet.ndarray.NDArray.asscalar),
 
[.wait_to_read()](https://mxnet.apache.org/api/python/ndarray/ndarray.html#mxnet.ndarray.NDArray.wait_to_read)
 and 
[.waitall()](https://mxnet.apache.org/api/python/ndarray/ndarray.html#mxnet.ndarray.waitall)).
 
+Many people are familiar with NumPy and flexible doing tensor manipulations 
using it. `NDArray API` offers  a convinient [.asnumpy() 
method](/api/python/docs/api/ndarray/ndarray.html#mxnet.ndarray.NDArray.asnumpy)
 to cast `nd.array` to `np.array`. However, by doing this cast and using 
`np.array` for calculation, we cannot use all the goodness of `Execution 
Engine`. All manipulations done on `np.array` are blocking. Moreover, the cast 
to `np.array` itself is a blocking operation (same as 
[.asscalar()](/api/python/docs/api/ndarray/ndarray.html#mxnet.ndarray.NDArray.asscalar),
 
[.wait_to_read()](/api/python/docs/api/ndarray/ndarray.html#mxnet.ndarray.NDArray.wait_to_read)
 and 
[.waitall()](/api/python/docs/api/ndarray/ndarray.html#mxnet.ndarray.waitall)).
 
 That means that if we have a long computation graph and, at some point, we 
want to cast the result to `np.array`, it may feel like the casting takes a lot 
of time. But what really takes this time is `Execution Engine`, which finishes 
all the async calculations we have pushed into it to get the final result, 
which then will be converted to `np.array`.
 
-Because of the blocking nature of [.asnumpy() 
method](https://mxnet.apache.org/api/python/ndarray/ndarray.html#mxnet.ndarray.NDArray.asnumpy),
 using it reduces the execution performance, especially if the calculations are 
done on GPU: Apache MXNet has to copy data from GPU to CPU to return 
`np.array`. 
+Because of the blocking nature of [.asnumpy() 
method](api/python/docs/api/ndarray/ndarray.html#mxnet.ndarray.NDArray.asnumpy),
 using it reduces the execution performance, especially if the calculations are 
done on GPU: Apache MXNet has to copy data from GPU to CPU to return `np.array`.
 
 Review comment:
   ```suggestion
   Because of the blocking nature of [.asnumpy() 
method](/api/python/docs/api/ndarray/ndarray.html#mxnet.ndarray.NDArray.asnumpy),
 using it reduces the execution performance, especially if the calculations are 
done on GPU: Apache MXNet has to copy data from GPU to CPU to return `np.array`.
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to