MXNet.jl icon indicating copy to clipboard operation
MXNet.jl copied to clipboard

NDArray with parametric type?

Open iblislin opened this issue 8 years ago • 6 comments

Should we make NDArray be parametric like Base's Array? One of the benefit I can tell is that it will help for multiple dispatch, but how about the performance?

iblislin avatar Nov 15 '17 02:11 iblislin

BTW, what's the pros and cons if we make NDArray as an subtype of AbstractArray?

iblislin avatar Nov 15 '17 06:11 iblislin

I have been wanting to make NDArray parametric for quite some time. #233 was one of the points where having it not be parametric caused big performance problems. I am not quite convinced if NDArray should be a subtype of AbstractArray, but maybe it should if we are pushing to make MXNet.jl more in line with Julia semantics.

vchuravy avatar Nov 15 '17 14:11 vchuravy

ok, I want to make NDArray parametric first #331

iblislin avatar Nov 22 '17 06:11 iblislin

I have no objection. What would the libmxnet function on NDArrays become? Are we going to define functions for all combinations of NDArrays or just define for the non-typed version?

pluskid avatar Nov 22 '17 17:11 pluskid

some of them benifit from dispatching, e.g. https://github.com/dmlc/MXNet.jl/pull/331/files#diff-0ca423d226049cc5744ebade856d9f1bR666

And most of functions are using UnionAll (NDArray without any parameter) type

iblislin avatar Nov 22 '17 17:11 iblislin

Thanks! This looks good to me.

pluskid avatar Nov 22 '17 17:11 pluskid