gigasquid commented on a change in pull request #13993: [Clojure] Add resource
scope to clojure package
URL: https://github.com/apache/incubator-mxnet/pull/13993#discussion_r253269849
##########
File path:
contrib/clojure-package/examples/imclassification/src/imclassification/train_mnist.clj
##########
@@ -96,18 +75,33 @@
(do
(println "Starting Training of MNIST ....")
(println "Running with context devices of" devs)
- (let [_mod (m/module (get-symbol) {:contexts devs})]
- (m/fit _mod {:train-data train-data
- :eval-data test-data
+ (resource-scope/with-let [_mod (m/module (get-symbol) {:contexts devs})]
+ (-> _mod
+ (m/fit {:train-data (mx-io/mnist-iter {:image (str data-dir
"train-images-idx3-ubyte")
Review comment:
It will work if they are `defs` outside, but you will still get the
undisposed ndarray warning. I refactored to move it out to functions which does
work and looks better too :)
----------------------------------------------------------------
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