Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modify RL examples to TF2 TL2 #969

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ A maintain release.
- remove `tl.layers.initialize_global_variables(sess)` (PR #931)
- change `tl.layers.core`, `tl.models.core` (PR #966)
- change `weights` into `all_weights`, `trainable_weights`, `nontrainable_weights`
- change reinforcement learning examples from TL1 to TL2 (PR #969)


### Dependencies Update
Expand All @@ -100,6 +101,7 @@ A maintain release.
- @warshallrho: #PR966
- @zsdonghao: #931
- @yd-yin: #963
- @quantumiracle: #969
- @dvklopfenstein: #971


Expand Down Expand Up @@ -327,8 +329,10 @@ To many PR for this update, please check [here](https://github.com/tensorlayer/t
- AtrousDeConv2dLayer added (PR #662)
- Fix bugs of using `tf.layers` in CNN (PR #686)
- Optimizer:

- AMSGrad Optimizer added based on `On the Convergence of Adam and Beyond (ICLR 2018)` (PR #636)
- Setup:

- Creation of installation flaggs `all`, `all_cpu`, and `all_gpu` (PR #660)
- Test:
- `test_utils_predict.py` added to reproduce and fix issue #288 (PR #566)
Expand Down Expand Up @@ -458,4 +462,4 @@ To many PR for this update, please check [here](https://github.com/tensorlayer/t
[1.10.0]: https://github.com/tensorlayer/tensorlayer/compare/1.9.1...1.10.0
[1.9.1]: https://github.com/tensorlayer/tensorlayer/compare/1.9.0...1.9.1
[1.9.0]: https://github.com/tensorlayer/tensorlayer/compare/1.8.5...1.9.0
[1.8.5]: https://github.com/tensorlayer/tensorlayer/compare/1.8.4...1.8.5
[1.8.5]: https://github.com/tensorlayer/tensorlayer/compare/1.8.4...1.8.5
2 changes: 1 addition & 1 deletion examples/basic_tutorials/tutorial_cifar10_cnn_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import (BatchNorm, Conv2d, Dense, Flatten, Input,
LocalResponseNorm, MaxPool2d)
Expand Down
2 changes: 1 addition & 1 deletion examples/basic_tutorials/tutorial_mnist_mlp_dynamic.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import Dense, Dropout, Input
from tensorlayer.models import Model
Expand Down
2 changes: 1 addition & 1 deletion examples/basic_tutorials/tutorial_mnist_mlp_dynamic_2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import Dense, Dropout, Input, LayerList
from tensorlayer.models import Model
Expand Down
2 changes: 1 addition & 1 deletion examples/basic_tutorials/tutorial_mnist_mlp_static.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import Dense, Dropout, Input
from tensorlayer.models import Model
Expand Down
2 changes: 1 addition & 1 deletion examples/basic_tutorials/tutorial_mnist_mlp_static_2.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import Dense, Dropout, Input
from tensorlayer.models import Model
Expand Down
2 changes: 1 addition & 1 deletion examples/basic_tutorials/tutorial_mnist_siamese.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import Dense, Dropout, Flatten, Input
from tensorlayer.models import Model
Expand Down
3 changes: 2 additions & 1 deletion examples/basic_tutorials/tutorial_mnist_simple.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#! /usr/bin/python
# -*- coding: utf-8 -*-

import numpy as np

import tensorflow as tf
import tensorlayer as tl
import numpy as np

tl.logging.set_verbosity(tl.logging.DEBUG)

Expand Down
4 changes: 2 additions & 2 deletions examples/data_process/tutorial_fast_affine_transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
import multiprocessing
import time

import cv2
import numpy as np
import tensorflow as tf

import cv2
import tensorflow as tf
import tensorlayer as tl

# tl.logging.set_verbosity(tl.logging.DEBUG)
Expand Down
2 changes: 1 addition & 1 deletion examples/data_process/tutorial_tf_dataset_voc.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl

# tf.logging.set_verbosity(tf.logging.DEBUG)
Expand Down
3 changes: 1 addition & 2 deletions examples/data_process/tutorial_tfrecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
import os

import numpy as np
import tensorflow as tf
from PIL import Image

import tensorflow as tf
import tensorlayer as tl

## Save data ==================================================================
Expand Down Expand Up @@ -97,4 +97,3 @@ def read_and_decode(filename):
print("img_batch : %s" % img_batch.shape)
print("label_batch : %s" % label_batch.shape)
tl.visualize.images2d(img_batch, second=1, saveable=False, name='batch', dtype=None, fig_idx=2020121)

2 changes: 1 addition & 1 deletion examples/data_process/tutorial_tfrecord2.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
import os

import numpy as np

# import matplotlib
# matplotlib.use('GTK')
import tensorflow as tf

import tensorlayer as tl

# Download data, and convert to TFRecord format, see ```tutorial_tfrecord.py```
Expand Down
2 changes: 1 addition & 1 deletion examples/data_process/tutorial_tfrecord3.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
import os

import numpy as np
import tensorflow as tf
from PIL import Image

import tensorflow as tf
import tensorlayer as tl


Expand Down
1 change: 0 additions & 1 deletion examples/database/dispatch_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import time

import tensorflow as tf

import tensorlayer as tl

tl.logging.set_verbosity(tl.logging.DEBUG)
Expand Down
1 change: 0 additions & 1 deletion examples/database/task_script.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
"""Sample task script."""

import tensorflow as tf

import tensorlayer as tl

tf.logging.set_verbosity(tf.logging.DEBUG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@
from xml.etree import ElementTree

import numpy as np

import tensorflow as tf
import tensorlayer as tl
from tensorflow.contrib import slim
from tensorflow.contrib.slim.python.slim.nets.inception_v3 import (inception_v3,
inception_v3_arg_scope)
Expand All @@ -29,8 +31,6 @@
from tensorflow.python.training.monitored_session import \
SingularMonitoredSession

import tensorlayer as tl

tf.logging.set_verbosity(tf.logging.DEBUG)
tl.logging.set_verbosity(tl.logging.DEBUG)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"""

import tensorflow as tf

import tensorlayer as tl

tf.logging.set_verbosity(tf.logging.DEBUG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import multiprocessing

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import (BatchNormLayer, Conv2d, DenseLayer,
FlattenLayer, InputLayer, MaxPool2d)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
# -*- coding: utf-8 -*-

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl

tf.logging.set_verbosity(tf.logging.DEBUG)
Expand Down
2 changes: 1 addition & 1 deletion examples/keras_tfslim/tutorial_keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl
from tensorlayer.layers import Input, Lambda

Expand Down
2 changes: 1 addition & 1 deletion examples/pretrained_cnn/tutorial_models_mobilenetv1.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl
from tensorlayer.models.imagenet_classes import class_names

Expand Down
2 changes: 1 addition & 1 deletion examples/pretrained_cnn/tutorial_models_squeezenetv1.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl
from tensorlayer.models.imagenet_classes import class_names

Expand Down
2 changes: 1 addition & 1 deletion examples/pretrained_cnn/tutorial_models_vgg16.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl
from tensorlayer.models.imagenet_classes import class_names

Expand Down
2 changes: 1 addition & 1 deletion examples/pretrained_cnn/tutorial_models_vgg19.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl
from tensorlayer.models.imagenet_classes import class_names

Expand Down
2 changes: 1 addition & 1 deletion examples/pretrained_cnn/tutorial_models_vgg_static.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl
from tensorlayer.models.imagenet_classes import class_names

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import time

import tensorflow as tf

import tensorlayer as tl

tf.logging.set_verbosity(tf.logging.DEBUG)
Expand Down
1 change: 0 additions & 1 deletion examples/quantized_net/tutorial_binarynet_mnist_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import time

import tensorflow as tf

import tensorlayer as tl

tf.logging.set_verbosity(tf.logging.DEBUG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import time

import tensorflow as tf

import tensorlayer as tl

tf.logging.set_verbosity(tf.logging.DEBUG)
Expand Down
1 change: 0 additions & 1 deletion examples/quantized_net/tutorial_dorefanet_mnist_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import time

import tensorflow as tf

import tensorlayer as tl

tf.logging.set_verbosity(tf.logging.DEBUG)
Expand Down
2 changes: 1 addition & 1 deletion examples/quantized_net/tutorial_quanconv_cifar10.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
import time

import numpy as np
import tensorflow as tf

import tensorflow as tf
import tensorlayer as tl

bitW = 8
Expand Down
1 change: 0 additions & 1 deletion examples/quantized_net/tutorial_quanconv_mnist.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import time

import tensorflow as tf

import tensorlayer as tl

tf.logging.set_verbosity(tf.logging.DEBUG)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
import time

import tensorflow as tf

import tensorlayer as tl

tf.logging.set_verbosity(tf.logging.DEBUG)
Expand Down
1 change: 0 additions & 1 deletion examples/quantized_net/tutorial_ternaryweight_mnist_cnn.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import time

import tensorflow as tf

import tensorlayer as tl

tf.logging.set_verbosity(tf.logging.DEBUG)
Expand Down