samskalicky commented on issue #17486: Update CustomOp doc with changes for GPU 
support
URL: https://github.com/apache/incubator-mxnet/pull/17486#issuecomment-585571802
 
 
   > Ok, thank you. I want to create a custom operator calling another operator 
which input NDArray. Both operator is async pushed to engine, I think this way 
is possible. Also, I am not clear on using mutateInputs API, how and when to 
use it? If you can provide a example of the mutateInputs API, I will be 
grateful to you~
   
   Hi @a550461053 currently the custom operator design focused on separating 
the custom operator from the MXNet backend source code complexity. This means 
that your custom operator can (must) be entirely separated from MXNet. So you 
cannot call a regular built-in MXNet operator from your custom operator. We 
have an item here #17006 for adding support in the future to be able to do 
this, but it is not implemented yet. 
   
   As for how to use mutateInputs, it works exactly as the doc describes:
   > This function allows you to mark some inputs to be mutable inputs. It is 
useful when using aux parameters for BatchNorm-like operators.
   
   So lets say you have an operator with 5 inputs, you can mark the indices of 
the inputs that you want to be mutable like this (for example mark the last two 
inputs as mutable):
   ```
   MXReturnValue batchNorm_mutateInputs(std::map<std::string, std::string> 
attrs,
                                        std::vector<int> &input_indices) {
     // mark mutable inputs                                                     
                   
     input_indices.push_back(3);
     input_indices.push_back(4);
     return MX_SUCCESS;
   }
   ```
   

----------------------------------------------------------------
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