You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 17, 2023. It is now read-only.
This page gives a very simple tutorial for creating operators in c++. After reading, however, I'm still unclear how to write a complicated operator in c++.
Compared to other frameworks (like caffe, pytorch), learning how to create operators in c++ is indeed much harder for mxnet/nnvm. A lot of new concepts, classes and macros are involved, and not explained in detail:
For Attribute Parser, what's NodeAttrs? What's the type of attrs->parsed? What field types are supported by DMLC_DECLARE_FIELD and how? Why I cannot find ParamParser and other classes in the C++ API?
What does it mean by "Outputs can be made invisible to other operators"?
For FGradient, what's NodePtr and NodeEntry? Why the prototype is so different from FCompute? No example is given for how to write a FGradient function and how to access NodePtr and NodeEntry.
For FCompute, what's TBlob? What is the difference of TBlob and NDArray/mshadow::Tensor? How can I know which input blobs need gradient and how can I tell which output blobs need gradient?
The existence of req argument in FCompute makes writing custom operators more difficult, although it may have some benefit for performance. Is it possible that I only handle the case of kWriteTo and the framework handle the other cases for me?
What's auxiliary states and how to use that?
How to declare backward dependency and request resource like the legacy operator interface?
For python, what's the lifetime of an instance of operator? Will an instance of operator be called more than once in a forward pass of a graph? For c++, how can I implement a stateful operator that has some internal states (possibly a very complicated c++ data structure in cpu memory) that are accessed across many forward and backward passes (but do not need to be saved)? And how to initialize those states?
Overall, the nnvm c++ API for creating custom operators is really complicated, especially compared to caffe. A thorough tutorial is required. Or better, simplify the API and make it easier to understand.