samskalicky commented on a change in pull request #17486: Update CustomOp doc 
with changes for GPU support
URL: https://github.com/apache/incubator-mxnet/pull/17486#discussion_r375020986
 
 

 ##########
 File path: example/extensions/lib_custom_op/README.md
 ##########
 @@ -56,87 +72,111 @@ For building a library containing your own custom 
operator, compose a C++ source
 - `forward` - Forward Computation (can be replace with `createOpState`, see 
below for details)
 
 Then compile it to `libmyop_lib.so` dynamic library using the following 
command:
+
 ```bash
 g++ -shared -fPIC -std=c++11 myop_lib.cc -o libmyop_lib.so -I 
../../../include/mxnet
 ```
 
+If you don't want to download MXNet source and choose only using `lib_api.h` 
header, you can copy the header over to the same folder of `myop_lib.cc` and 
run:
+
+```bash
+g++ -shared -fPIC -std=c++11 myop_lib.cc -o libmyop_lib.so
+```
+
 Finally, you can write a Python script to load the library and run your custom 
operator:
+
 ```python
 import mxnet as mx
 mx.library.load(‘libmyop_lib.so’)
 mx.nd.my_op(...)
 ```
 
-### Writing Regular Custom Operator:
+### Writing A Regular Custom Operator
 
-There are several essential building blocks for making a (stateless) custom 
operator:
+There are several essential building blocks for making a custom operator:
 
 * [initialize](./gemm_lib.cc#L227):
     * This function is the library initialization function necessary for any 
dynamic libraries. It checks if you are using a compatible version of MXNet. 
Note that this `version` parameter is passed from MXNet when library is loaded.
 
 Review comment:
   This function is called when MXNet first loads the library. MXNet passes its 
version to this function when called. This gives the library the ability to 
check which version of MXNet is being used. It also provides a place where 
library state can be initialized. 

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to