gigasquid commented on a change in pull request #12387: MXNET-873 - Bring
Clojure Package Inline with New DataDesc and Layout in Scala Package
URL: https://github.com/apache/incubator-mxnet/pull/12387#discussion_r216831829
##########
File path: contrib/clojure-package/src/org/apache/clojure_mxnet/io.clj
##########
@@ -213,14 +245,23 @@
last-batch-handle "pad"
data-name "data"
label-name "label"}}]
- (new NDArrayIter
- (util/vec->indexed-seq data)
- (if label (util/vec->indexed-seq label) (util/empty-indexed-seq))
- (int data-batch-size)
- shuffle
- last-batch-handle
- data-name
- label-name))
+ (if (map? data)
Review comment:
Yes - it checks to see if the data is a map, if so, it is in the form of
having a DataDesc associated with it and will be dispatched to the correct Java
function signature and with scala interop. If it is not a map, it will dispatch
to the original Java function signature without DataDesc.
The argument checking for the correct data structures can be improved by
using core.spec in Clojure. It adds gradual type checking. It is in use in the
module api, but it hasn't been added in yet in this namespace. I added a line
item in the TODO page for the Clojure package to capture it for later
improvement work.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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