rondogency commented on a change in pull request #17270: [WIP] Dynamic custom 
operator GPU support
URL: https://github.com/apache/incubator-mxnet/pull/17270#discussion_r368173736
 
 

 ##########
 File path: include/mxnet/lib_api.h
 ##########
 @@ -566,16 +609,20 @@ typedef MXReturnValue 
(*createOpState_t)(std::map<std::string, std::string>,
 class CustomOp {
  public:
   explicit CustomOp(const char* op_name) : name(op_name),
-    forward(NULL), backward(NULL), parse_attrs(NULL), infer_type(NULL),
-    infer_shape(NULL), mutate_inputs(NULL), create_opstate(NULL),
-    isSGop(false) {}
-  ~CustomOp() {}
-  CustomOp& setForward(fcomp_t fcomp) {
-    forward = fcomp;
+    parse_attrs(NULL), infer_type(NULL), infer_shape(NULL), 
mutate_inputs(NULL),
+    create_opstate(NULL), isSGop(false) {}
+  CustomOp& setForward(fcomp_t fcomp, std::string ctx) {
+    char* cstr = new char[ctx.length()+1];
+    strncpy(cstr, ctx.c_str(), ctx.length()+1);
+    forward_ctx_cstr.push_back(cstr);
 
 Review comment:
   changed string in parameter to be const char *, as user gonna pass in a 
static string, in this way we can avoid a redundant copy

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