From dafb139c3f0fe9b89d7dff752ac939c6ee95f1da Mon Sep 17 00:00:00 2001 From: Ke Han Date: Wed, 24 Jun 2020 17:24:50 +0800 Subject: [PATCH] * Fix input out of index and rscalar of greater --- src/api/operator/numpy/np_elemwise_broadcast_logic_op.cc | 3 ++- src/api/operator/numpy/np_matrix_op.cc | 7 ++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/api/operator/numpy/np_elemwise_broadcast_logic_op.cc b/src/api/operator/numpy/np_elemwise_broadcast_logic_op.cc index 9363481f64f0..4e3c7b2bfcb3 100644 --- a/src/api/operator/numpy/np_elemwise_broadcast_logic_op.cc +++ b/src/api/operator/numpy/np_elemwise_broadcast_logic_op.cc @@ -98,7 +98,8 @@ MXNET_REGISTER_API("_npi.greater") using namespace runtime; const nnvm::Op* op = Op::Get("_npi_greater"); const nnvm::Op* op_scalar = Op::Get("_npi_greater_scalar"); - UFuncHelper(args, ret, op, op_scalar, nullptr); + const nnvm::Op* op_rscalar = Op::Get("_npi_greater_scalar"); + UFuncHelper(args, ret, op, op_scalar, op_rscalar); }); } // namespace mxnet diff --git a/src/api/operator/numpy/np_matrix_op.cc b/src/api/operator/numpy/np_matrix_op.cc index 90274278beb8..98841cf971a9 100644 --- a/src/api/operator/numpy/np_matrix_op.cc +++ b/src/api/operator/numpy/np_matrix_op.cc @@ -626,10 +626,11 @@ MXNET_REGISTER_API("_npi.vstack") attrs.op = op; SetAttrDict(&attrs); int num_outputs = 0; - std::vector inputs; - for (int i = 0; i < param.num_args; ++i) { - inputs.push_back(args[i].operator mxnet::NDArray*()); + std::vector inputs_vec(args.size(), nullptr); + for (int i = 0; i < args_size; ++i) { + inputs_vec[i] = args[i].operator mxnet::NDArray*(); } + NDArray** inputs = inputs_vec.data(); auto ndoutputs = Invoke(op, &attrs, param.num_args, &inputs[0], &num_outputs, nullptr); *ret = ndoutputs[0]; });