You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by ma...@apache.org on 2018/11/27 11:03:37 UTC

[incubator-mxnet] branch master updated: Fix infoGan Gluon tutorial errors. (#13416)

This is an automated email from the ASF dual-hosted git repository.

marcoabreu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 075120e  Fix infoGan Gluon tutorial errors. (#13416)
075120e is described below

commit 075120ebb892341bb39c5962e17abc5e8e7b9733
Author: Vishaal Kapoor <40...@users.noreply.github.com>
AuthorDate: Tue Nov 27 03:03:18 2018 -0800

    Fix infoGan Gluon tutorial errors. (#13416)
    
    - Update notebook to avoid divide by 0 causing a warning.
    - Add MXBoard dependency.
---
 ci/docker/install/ubuntu_tutorials.sh | 4 ++--
 docs/tutorials/gluon/info_gan.md      | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/ci/docker/install/ubuntu_tutorials.sh b/ci/docker/install/ubuntu_tutorials.sh
index 9877475..404d4bb 100755
--- a/ci/docker/install/ubuntu_tutorials.sh
+++ b/ci/docker/install/ubuntu_tutorials.sh
@@ -23,5 +23,5 @@
 set -ex
 apt-get update || true
 apt-get install graphviz python-opencv
-pip2 install jupyter matplotlib Pillow opencv-python scikit-learn graphviz tqdm
-pip3 install jupyter matplotlib Pillow opencv-python scikit-learn graphviz tqdm
+pip2 install jupyter matplotlib Pillow opencv-python scikit-learn graphviz tqdm mxboard
+pip3 install jupyter matplotlib Pillow opencv-python scikit-learn graphviz tqdm mxboard
diff --git a/docs/tutorials/gluon/info_gan.md b/docs/tutorials/gluon/info_gan.md
index c8f07c6..8b2668a 100644
--- a/docs/tutorials/gluon/info_gan.md
+++ b/docs/tutorials/gluon/info_gan.md
@@ -311,18 +311,18 @@ with SummaryWriter(logdir='./logs/') as sw:
 
             # logging
             if idx % 10 == 0:
-           
+                count = idx + 1
                 logging.info('speed: {} samples/s'.format(batch_size / (time.time() - starttime)))
                 logging.info('discriminator loss = %f, generator loss = %f at iter %d epoch %d'
-                         %(d_error_epoch.asscalar()/idx,g_error_epoch.asscalar()/idx, idx, epoch))
+                         %(d_error_epoch.asscalar()/count,g_error_epoch.asscalar()/count, count, epoch))
 
                 g_input,_,_ = create_generator_input()
                 
                 # create some fake image for logging in MXBoard
                 fake_image = generator(g_input)
 
-                sw.add_scalar(tag='Loss_D', value={'test':d_error_epoch.asscalar()/idx}, global_step=counter)
-                sw.add_scalar(tag='Loss_G', value={'test':d_error_epoch.asscalar()/idx}, global_step=counter)
+                sw.add_scalar(tag='Loss_D', value={'test':d_error_epoch.asscalar()/count}, global_step=counter)
+                sw.add_scalar(tag='Loss_G', value={'test':d_error_epoch.asscalar()/count}, global_step=counter)
                 sw.add_image(tag='data_image', image=((fake_image[0]+ 1.0) * 127.5).astype(np.uint8)  , global_step=counter)
                 sw.flush()