You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by cm...@apache.org on 2018/11/16 16:36:13 UTC
[incubator-mxnet] branch can-you-gan updated (beeada6 -> e045277)
This is an automated email from the ASF dual-hosted git repository.
cmeier pushed a change to branch can-you-gan
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git.
from beeada6 tweaks
new 7cdfc04 explore flan function
new e045277 do for n
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../examples/gan/src/gan/gan_mnist.clj | 31 +++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
[incubator-mxnet] 02/02: do for n
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmeier pushed a commit to branch can-you-gan
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit e0452776d8b1113ca95b65932293b2b327ee0eaf
Author: gigasquid <cm...@gigasquidsoftware.com>
AuthorDate: Fri Nov 16 11:34:12 2018 -0500
do for n
---
.../examples/gan/src/gan/gan_mnist.clj | 33 ++++++++++++----------
1 file changed, 18 insertions(+), 15 deletions(-)
diff --git a/contrib/clojure-package/examples/gan/src/gan/gan_mnist.clj b/contrib/clojure-package/examples/gan/src/gan/gan_mnist.clj
index c1e635e..f95ea10 100644
--- a/contrib/clojure-package/examples/gan/src/gan/gan_mnist.clj
+++ b/contrib/clojure-package/examples/gan/src/gan/gan_mnist.clj
@@ -362,32 +362,35 @@
(train devs)))
-(defn explore-flans [epoch]
+(defn explore-flans [epoch num]
(let [mod-g (-> (m/load-checkpoint {:contexts [(context/default-context)]
- :data-names ["rand"]
+ :data-names ["rand"]
:label-names [""]
:prefix "model-g"
:epoch epoch
:load-optimizer-states true})
(m/bind {:data-shapes (mx-io/provide-data rand-noise-iter)})
(m/init-params {:initializer (init/normal 0.02)})
- (m/init-optimizer {:optimizer (opt/adam {:learning-rate lr :wd 0.0 :beta1 beta1})}))
- rbatch (mx-io/next rand-noise-iter)
- out-g (-> mod-g
- (m/forward rbatch)
- (m/outputs))]
- (println "Generating image from " epoch)
- (viz/im-sav {:title (str "explore-" epoch "-" 0)
- :output-path output-path
- :x (ffirst out-g)
- :flip false})
- (-> (img/load-image (str "results/explore-" epoch "-" 0 ".jpg"))
- (img/show))))
+ (m/init-optimizer {:optimizer (opt/adam {:learning-rate lr :wd 0.0 :beta1 beta1})}))]
+
+ (println "Generating images from " epoch)
+ (dotimes [i num]
+ (let [rbatch (mx-io/next rand-noise-iter)
+ out-g (-> mod-g
+ (m/forward rbatch)
+ (m/outputs))]
+ (viz/im-sav {:title (str "explore-" epoch "-" i)
+ :output-path output-path
+ :x (ffirst out-g)
+ :flip false})
+ (-> (img/load-image (str "results/explore-" epoch "-" i ".jpg"))
+ (img/show))))))
(comment
(train [(context/cpu)])
- (explore-flans 192)
+
+ (explore-flans 195 2)
)
[incubator-mxnet] 01/02: explore flan function
Posted by cm...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
cmeier pushed a commit to branch can-you-gan
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git
commit 7cdfc04cf2f6aa90701c627e4b79167817dea81b
Author: gigasquid <cm...@gigasquidsoftware.com>
AuthorDate: Fri Nov 16 11:21:54 2018 -0500
explore flan function
---
.../examples/gan/src/gan/gan_mnist.clj | 28 +++++++++++++++++++++-
1 file changed, 27 insertions(+), 1 deletion(-)
diff --git a/contrib/clojure-package/examples/gan/src/gan/gan_mnist.clj b/contrib/clojure-package/examples/gan/src/gan/gan_mnist.clj
index ea67800..c1e635e 100644
--- a/contrib/clojure-package/examples/gan/src/gan/gan_mnist.clj
+++ b/contrib/clojure-package/examples/gan/src/gan/gan_mnist.clj
@@ -45,7 +45,7 @@
(io/make-parents (str output-path "gout"))
(defn last-saved-model-number []
- (some->> "model"
+ (some->> "."
clojure.java.io/file
file-seq
(filter #(.isFile %))
@@ -361,7 +361,33 @@
(println "Running with context devices of" devs)
(train devs)))
+
+(defn explore-flans [epoch]
+
+ (let [mod-g (-> (m/load-checkpoint {:contexts [(context/default-context)]
+ :data-names ["rand"]
+ :label-names [""]
+ :prefix "model-g"
+ :epoch epoch
+ :load-optimizer-states true})
+ (m/bind {:data-shapes (mx-io/provide-data rand-noise-iter)})
+ (m/init-params {:initializer (init/normal 0.02)})
+ (m/init-optimizer {:optimizer (opt/adam {:learning-rate lr :wd 0.0 :beta1 beta1})}))
+ rbatch (mx-io/next rand-noise-iter)
+ out-g (-> mod-g
+ (m/forward rbatch)
+ (m/outputs))]
+ (println "Generating image from " epoch)
+ (viz/im-sav {:title (str "explore-" epoch "-" 0)
+ :output-path output-path
+ :x (ffirst out-g)
+ :flip false})
+ (-> (img/load-image (str "results/explore-" epoch "-" 0 ".jpg"))
+ (img/show))))
+
(comment
(train [(context/cpu)])
+ (explore-flans 192)
+
)