hzfan commented on a change in pull request #17873: [Numpy] FFI: array_split,
v/h/dsplit
URL: https://github.com/apache/incubator-mxnet/pull/17873#discussion_r395423393
##########
File path: src/api/operator/numpy/np_matrix_op.cc
##########
@@ -142,4 +142,158 @@ MXNET_REGISTER_API("_npi.rot90")
*ret = ndoutputs[0];
});
+MXNET_REGISTER_API("_npi.array_split")
+.set_body([](runtime::MXNetArgs args, runtime::MXNetRetValue* ret) {
+ using namespace runtime;
+ static const nnvm::Op* op = Op::Get("_npi_array_split");
+ nnvm::NodeAttrs attrs;
+ op::SplitParam param;
+ param.axis = args[2].operator int();
+ param.squeeze_axis = false;
+ if (args[1].type_code() == kDLInt) {
+ param.indices = TShape(0, 0);
+ param.sections = args[1].operator int();
+ CHECK_GT(param.sections, 0)
Review comment:
Do we need to check `shape[axis] % param.sections == 0`? like
https://github.com/apache/incubator-mxnet/pull/17873/files#diff-21ec839e5c3e65fe0e31e75da91d4996R196
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services