-
Notifications
You must be signed in to change notification settings - Fork 6.8k
MXNET-873 - Bring Clojure Package Inline with New DataDesc and Layout in Scala Package #12387
Conversation
…if fixed - update Module example to use provide-data-desc and provide-label-desc
@lanking520 please give a look when you get a chance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your effort pushing the same changes on Clojure! Overall looks good
@@ -92,7 +92,7 @@ | |||
|
|||
(comment | |||
|
|||
(predict "https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/doc/tutorials/python/predict_image/cat.jpg") | |||
(predict "https://raw.githubusercontent.com/dmlc/web-data/master/mxnet/doc/tutorials/python/predict_image/cat.jpg" true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does this true
mean in here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's for the example - it controls whether the image url displays in a popup for you view
https://github.com/apache/incubator-mxnet/blob/6fd245d1ce28a7bc09b83aeb2a1233f085210037/contrib/clojure-package/examples/pre-trained-models/src/pre_trained_models/predict_image.clj#L42
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: not a big deal since it's a helper fn in an example, but it'd make sense to use an options map or kw arg ({:display true}
or :display true
). [outside this PR though, also]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes agree
@@ -144,7 +144,7 @@ | |||
which must be known from the rest of the net." | |||
([start {:keys [step repeat dtype] | |||
:or {step (float 1) repeat (int 1) dtype base/MX_REAL_TYPE} | |||
:as opts}] | |||
:as opts}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
space issue...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case the cljfmt
tool is fixing my earlier mistake :)
Thanks for the feedback @lanking520 😸 |
@gigasquid Sorry about not being so helpful there... I will try to learn Clojure grammer and review it again... Generally, the Scala DataDesc want user to pass in as DataDesc type instead of ListMap. Then most of the iterators needs to change a little bit based on this change. |
Thanks @lanking520 I did change the NDarrayIter to reflect this change. You can probably see it easiest in the test case https://github.com/apache/incubator-mxnet/pull/12387/files#diff-93817a3c2dc0abcdbb709a400bddc997R194 Please feel free to ping me with any questions. |
last-batch-handle | ||
data-name | ||
label-name)) | ||
(let [specify-data-desc? (map? data)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: is this just in the let
for a self-documenting name/rationale?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can be dropped - thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a nit, otherwise LGTM
Thanks for the feedback @benkamphaus. @nswamy/ @szha - I think this is ready for a final review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good to me for the rest.
last-batch-handle | ||
data-name | ||
label-name)) | ||
(if (map? data) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it mean if data is map? what if it is not? I don't know clojure well, just want to make sure it is intended.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Thanks @yzhliu for the feedback 😸 Unless anyone has any objections, I will go ahead a merge shortly. |
… in Scala Package (apache#12387) * Bring clojure package inline with new DataDesc and Layout in Scala package * formatting cljfmt * revert the implementation of module fit back now that DataDesc issue if fixed - update Module example to use provide-data-desc and provide-label-desc * update to provide-data-desc and provide-label-desc * decrease epochs to speed example * Add tests and docstrings * remove let
Description
The Scala package has updated the DataDesc to include Layout. The Clojure package has been updated to move inline with it.
Checklist
Essentials
Please feel free to remove inapplicable items for your PR.
Changes
module.fit
interop code has been restored. The work arounds required by the old DataDesc has been resolved with this PR [MXNET-689] add DataDesc type for the Scala Package #11844provide-data-desc
instead ofprovide-data