Skip to content

Commit ac9304b

Browse files
zsdonghaoluomai
authored andcommitted
Improve mnist examples and fix bugs. (#382)
* simplified mnist example * simplied mnist example * simplied mnist example * simplied mnist example * simplied mnist example * IMPORTANT : fixed D_TYPE bug / as we splited the layers into many file, the D_TYPE in core.py cant change in other files * update layer config. * format code * decouple set_keep. * fix hao comments.
1 parent 4a183c6 commit ac9304b

33 files changed

+138
-180
lines changed

example/tutorial_atari_pong.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
import numpy as np
2626
import tensorflow as tf
27-
import tensorlayer as tl
28-
from tensorlayer.layers import *
2927

3028
import gym
29+
import tensorlayer as tl
30+
from tensorlayer.layers import *
3131

3232
# hyper-parameters
3333
image_size = 80

example/tutorial_bipedalwalker_a3c_continuous_action.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636

3737
import numpy as np
3838
import tensorflow as tf
39-
import tensorlayer as tl
40-
from tensorlayer.layers import *
4139

4240
import gym
41+
import tensorlayer as tl
42+
from tensorlayer.layers import *
4343

4444
GAME = 'BipedalWalker-v2' # BipedalWalkerHardcore-v2
4545
OUTPUT_GRAPH = False

example/tutorial_cartpole_ac.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636

3737
import numpy as np
3838
import tensorflow as tf
39-
import tensorlayer as tl
40-
from tensorlayer.layers import *
4139

4240
import gym
41+
import tensorlayer as tl
42+
from tensorlayer.layers import *
4343

4444
np.random.seed(2)
4545
tf.set_random_seed(2) # reproducible

example/tutorial_cifar10.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import numpy as np
99
import tensorflow as tf
10+
1011
import tensorlayer as tl
1112
from tensorlayer.layers import *
1213

example/tutorial_cifar10_tfrecord.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444

4545
# import numpy as np
4646
import tensorflow as tf
47+
4748
import tensorlayer as tl
4849
from tensorlayer.layers import *
4950

example/tutorial_frozenlake_dqn.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,10 @@
2626
2727
"""
2828

29+
import gym
2930
import tensorlayer as tl
3031
from tensorlayer.layers import *
3132

32-
import gym
33-
3433
env = gym.make('FrozenLake-v0')
3534

3635

example/tutorial_generate_text.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@
2727

2828
import numpy as np
2929
import tensorflow as tf
30-
import tensorlayer as tl
31-
from tensorlayer.layers import *
3230

3331
import nltk
32+
import tensorlayer as tl
33+
from tensorlayer.layers import *
3434

3535
# # _UNK = "_UNK"
3636

example/tutorial_imagenet_inceptionV3_distributed.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020

2121
import numpy as np
2222
import tensorflow as tf
23-
import tensorlayer as tl
2423
from tensorflow.contrib import slim
2524
from tensorflow.contrib.slim.python.slim.nets.inception_v3 import (inception_v3, inception_v3_arg_scope)
2625
from tensorflow.python.framework.errors_impl import OutOfRangeError
@@ -29,6 +28,8 @@
2928
from tensorflow.python.training.monitored_session import \
3029
SingularMonitoredSession
3130

31+
import tensorlayer as tl
32+
3233
########## VARIABLES ##########
3334

3435
# get the dataset: https://www.kaggle.com/c/imagenet-object-localization-challenge/data

example/tutorial_imdb_fasttext.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
import numpy as np
3333
import tensorflow as tf
34+
3435
import tensorlayer as tl
3536
from tensorlayer.layers import *
3637

example/tutorial_inceptionV3_tfslim.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,12 @@
3131
import skimage.io
3232
import skimage.transform
3333
import tensorflow as tf
34-
import tensorlayer as tl
3534
# from scipy.misc import imread, imresize
3635
# from tensorflow.contrib.slim.python.slim.nets.alexnet import alexnet_v2
3736
from tensorflow.contrib.slim.python.slim.nets.inception_v3 import (inception_v3, inception_v3_arg_scope)
3837

38+
import tensorlayer as tl
39+
3940
slim = tf.contrib.slim
4041
try:
4142
from data.imagenet_classes import *

0 commit comments

Comments
 (0)