[C++ Symbolic] MXNet design question


#1

Why is the entire operator API not available for NDArrays? The Symbolic API is used for constructing the computational graph and then executing said graph on NDArrays. Thus, everything is operated on NDArrays anyways. So why aren’t these methods available to NDArrays? This is a question about the MXNet program design.

Edit: These methods are in fact available but it is not clear how to access. A simple example is below for the sum() function, which performs a sum reduction over an axis. I put this in a local utility file. I suggest someone add this to documentation so that it is more clear to C++ users.

inline mxnet::cpp::NDArray sum(mxnet::cpp::NDArray x, size_t axis = 0) {
  mxnet::cpp::NDArray ret;
  mxnet::cpp::Operator("sum")(x,axis).Invoke(ret);
  return ret;
}

#2

hi, please feel free to submit a pr on the mxnet repo with the documentation changes :slight_smile:


#3

This functionality doesn’t work for all symbolic operations, so I won’t put it in documentation. If I figure out how it works I’ll put it in documentation.