You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/09/05 20:14:16 UTC

[GitHub] vandanavk commented on a change in pull request #12419: [MXNET-580] Add SN-GAN example

vandanavk commented on a change in pull request #12419: [MXNET-580] Add SN-GAN example
URL: https://github.com/apache/incubator-mxnet/pull/12419#discussion_r215410492
 
 

 ##########
 File path: example/gluon/sn-gan/spectral_normalization_gan.py
 ##########
 @@ -0,0 +1,259 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+# This example is inspired by https://github.com/jason71995/Keras-GAN-Library,
+# https://github.com/kazizzad/DCGAN-Gluon-MxNet/blob/master/MxnetDCGAN.ipynb
+# https://github.com/apache/incubator-mxnet/blob/master/example/gluon/dcgan.py
+
+
+import math
+import os
+import random
+import logging
+
+import imageio
+import numpy as np
+
+import mxnet as mx
+from mxnet import nd, autograd
+from mxnet import gluon
+from mxnet.gluon.data.vision import CIFAR10
+from mxnet.gluon import Block
+
+
+BATCH_SIZE = 64  # input batch size
+IMAGE_SIZE = 64  # image size
+Z_DIM = 100  # dimension of the latent z vector
+NUM_ITER = 1000  # number of epochs to train for
+LEARNING_RATE = 0.0002  # learning rate
+BETA = 0.5  # beta1 for adam
+OUTPUT_DIR = './data'  # output directory
+MANUAL_SEED = random.randint(1, 10000)  # manual seed
+CTX = mx.gpu()  # change to gpu if you have gpu
 
 Review comment:
   Default should be cpu?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services