You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by jx...@apache.org on 2017/09/21 18:45:03 UTC

[incubator-mxnet] branch v0.11.0 updated: Fix computation of num_inputs for Python API create_operator_entry for custom operators with 0 arguments. (#7977)

This is an automated email from the ASF dual-hosted git repository.

jxie pushed a commit to branch v0.11.0
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/v0.11.0 by this push:
     new 77c5079  Fix computation of num_inputs for Python API create_operator_entry for custom operators with 0 arguments. (#7977)
77c5079 is described below

commit 77c50791d4ee87544b04d8517941b437d8231f2f
Author: Felix Hieber <fh...@users.noreply.github.com>
AuthorDate: Thu Sep 21 20:44:59 2017 +0200

    Fix computation of num_inputs for Python API create_operator_entry for custom operators with 0 arguments. (#7977)
---
 src/operator/custom/custom.cc | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/operator/custom/custom.cc b/src/operator/custom/custom.cc
index 59414d3..5ead8a0 100644
--- a/src/operator/custom/custom.cc
+++ b/src/operator/custom/custom.cc
@@ -225,9 +225,8 @@ OpStatePtr CreateState(const NodeAttrs& attrs, Context ctx,
                        const std::vector<int>& in_type) {
   const CustomParam& params = nnvm::get<CustomParam>(attrs.parsed);
 
-  size_t total = params.num_args + params.num_outs + params.num_auxs;
-  std::vector<uint32_t*> shapes(total);
-  std::vector<int> ndims(total);
+  std::vector<uint32_t*> shapes(params.num_args);
+  std::vector<int> ndims(params.num_args);
   size_t buff_size = 0;
   for (const auto& i : in_shape) buff_size += i.ndim();
   std::vector<uint32_t> buff(buff_size);
@@ -246,7 +245,7 @@ OpStatePtr CreateState(const NodeAttrs& attrs, Context ctx,
   MXCallbackList *op_info = new MXCallbackList;
   CHECK(reinterpret_cast<CustomOpCreateFunc>(
       params.info->callbacks[kCustomOpPropCreateOperator])(
-          os.str().c_str(), shapes.size(), shapes.data(), ndims.data(), in_type.data(),
+          os.str().c_str(), params.num_args, shapes.data(), ndims.data(), in_type.data(),
           op_info, params.info->contexts[kCustomOpPropCreateOperator]));
 
   CustomParam state = params;

-- 
To stop receiving notification emails like this one, please contact
['"commits@mxnet.apache.org" <co...@mxnet.apache.org>'].