Skip to content

Commit e5b99be

Browse files
committed
fix yapf
1 parent 7bbfc98 commit e5b99be

8 files changed

+39
-22
lines changed

examples/quantized_net/tutorial_binarynet_cifar10.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,16 @@
3939
4040
"""
4141

42+
import multiprocessing
4243
import time
44+
4345
import numpy as np
44-
import multiprocessing
4546
import tensorflow as tf
4647
import tensorlayer as tl
48+
from tensorlayer.layers import (BinaryConv2d, BinaryDense, Conv2d, Dense,
49+
Flatten, Input, LocalResponseNorm, MaxPool2d,
50+
Sign)
4751
from tensorlayer.models import Model
48-
from tensorlayer.layers import (Input, Conv2d, Sign, MaxPool2d, LocalResponseNorm, BinaryConv2d, BinaryDense, Flatten, Dense)
49-
5052

5153
tl.logging.set_verbosity(tl.logging.DEBUG)
5254

@@ -209,4 +211,4 @@ def accuracy(_logits, y_batch):
209211
test_acc += np.mean(np.equal(np.argmax(_logits, 1), y_batch))
210212
n_iter += 1
211213
print(" test loss: {}".format(test_loss / n_iter))
212-
print(" test acc: {}".format(test_acc / n_iter))
214+
print(" test acc: {}".format(test_acc / n_iter))

examples/quantized_net/tutorial_binarynet_mnist_cnn.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
# -*- coding: utf-8 -*-
33

44
import time
5+
56
import numpy as np
67
import tensorflow as tf
78
import tensorlayer as tl
9+
from tensorlayer.layers import (BatchNorm, BinaryConv2d, BinaryDense, Flatten,
10+
Input, MaxPool2d, Sign)
811
from tensorlayer.models import Model
9-
from tensorlayer.layers import (Input, BinaryConv2d, MaxPool2d, BatchNorm, Sign, Flatten, BinaryDense)
1012

1113
tl.logging.set_verbosity(tl.logging.DEBUG)
1214

@@ -100,4 +102,4 @@ def accuracy(_logits, y_batch):
100102
test_acc += np.mean(np.equal(np.argmax(_logits, 1), y_test_a))
101103
n_test_batch += 1
102104
print(" test loss: %f" % (test_loss / n_test_batch))
103-
print(" test acc: %f" % (test_acc / n_test_batch))
105+
print(" test acc: %f" % (test_acc / n_test_batch))

examples/quantized_net/tutorial_dorefanet_cifar10.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,19 @@
3939
4040
"""
4141

42+
import multiprocessing
4243
import time
44+
4345
import numpy as np
44-
import multiprocessing
4546
import tensorflow as tf
4647
import tensorlayer as tl
48+
from tensorlayer.layers import (Conv2d, Dense, DorefaConv2d, DorefaDense,
49+
Flatten, Input, LocalResponseNorm, MaxPool2d)
4750
from tensorlayer.models import Model
48-
from tensorlayer.layers import (Input, Conv2d, MaxPool2d, LocalResponseNorm, DorefaConv2d, DorefaDense, Flatten, Dense)
4951

5052
tl.logging.set_verbosity(tl.logging.DEBUG)
5153

54+
# Download data, and convert to TFRecord format, see ```tutorial_tfrecord.py```
5255
# prepare cifar10 data
5356
X_train, y_train, X_test, y_test = tl.files.load_cifar10_dataset(shape=(-1, 32, 32, 3), plotable=False)
5457

examples/quantized_net/tutorial_dorefanet_mnist_cnn.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
# -*- coding: utf-8 -*-
33

44
import time
5+
56
import numpy as np
67
import tensorflow as tf
78
import tensorlayer as tl
9+
from tensorlayer.layers import (BatchNorm, Dense, DorefaConv2d, DorefaDense,
10+
Flatten, Input, MaxPool2d)
811
from tensorlayer.models import Model
9-
from tensorlayer.layers import (Input, DorefaConv2d, MaxPool2d, BatchNorm, Flatten, DorefaDense, Dense)
1012

1113
tl.logging.set_verbosity(tl.logging.DEBUG)
1214

@@ -95,4 +97,4 @@ def accuracy(_logits, y_batch):
9597
test_acc += np.mean(np.equal(np.argmax(_logits, 1), y_test_a))
9698
n_test_batch += 1
9799
print(" test loss: %f" % (test_loss / n_test_batch))
98-
print(" test acc: %f" % (test_acc / n_test_batch))
100+
print(" test acc: %f" % (test_acc / n_test_batch))

examples/quantized_net/tutorial_quanconv_cifar10.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,19 @@
3838
we run them inside 16 separate threads which continuously fill a TensorFlow queue.
3939
4040
"""
41+
import multiprocessing
4142
import time
43+
4244
import numpy as np
43-
import multiprocessing
4445
import tensorflow as tf
4546
import tensorlayer as tl
47+
from tensorlayer.layers import (Dense, Flatten, Input, MaxPool2d,
48+
QuanConv2dWithBN, QuanDense)
4649
from tensorlayer.models import Model
47-
from tensorlayer.layers import (Input, MaxPool2d, QuanConv2dWithBN, QuanDense, Flatten, Dense)
4850

4951
tl.logging.set_verbosity(tl.logging.DEBUG)
5052

53+
# Download data, and convert to TFRecord format, see ```tutorial_tfrecord.py```
5154
# prepare cifar10 data
5255
X_train, y_train, X_test, y_test = tl.files.load_cifar10_dataset(shape=(-1, 32, 32, 3), plotable=False)
5356

@@ -200,4 +203,3 @@ def accuracy(_logits, y_batch):
200203
n_iter += 1
201204
print(" test loss: {}".format(test_loss / n_iter))
202205
print(" test acc: {}".format(test_acc / n_iter))
203-

examples/quantized_net/tutorial_quanconv_mnist.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@
33

44
import time
55

6-
import tensorflow as tf
76
import numpy as np
8-
7+
import tensorflow as tf
98
import tensorlayer as tl
9+
from tensorlayer.layers import (Dense, Dropout, Flatten, Input, MaxPool2d,
10+
QuanConv2d, QuanConv2dWithBN, QuanDense,
11+
QuanDenseLayerWithBN)
1012
from tensorlayer.models import Model
11-
from tensorlayer.layers import (Input, Dense, Dropout, Flatten, QuanConv2dWithBN, QuanDenseLayerWithBN, MaxPool2d, QuanConv2d, QuanDense)
1213

1314
tl.logging.set_verbosity(tl.logging.DEBUG)
1415

@@ -105,4 +106,4 @@ def accuracy(_logits, y_batch):
105106
test_acc += np.mean(np.equal(np.argmax(_logits, 1), y_test_a))
106107
n_test_batch += 1
107108
print(" test loss: %f" % (test_loss / n_test_batch))
108-
print(" test acc: %f" % (test_acc / n_test_batch))
109+
print(" test acc: %f" % (test_acc / n_test_batch))

examples/quantized_net/tutorial_ternaryweight_cifar10.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,20 @@
3838
we run them inside 16 separate threads which continuously fill a TensorFlow queue.
3939
4040
"""
41+
import multiprocessing
4142
import time
43+
4244
import numpy as np
43-
import multiprocessing
4445
import tensorflow as tf
4546
import tensorlayer as tl
47+
from tensorlayer.layers import (Conv2d, Dense, Flatten, Input,
48+
LocalResponseNorm, MaxPool2d, TernaryConv2d,
49+
TernaryDense)
4650
from tensorlayer.models import Model
47-
from tensorlayer.layers import (Input, Conv2d, MaxPool2d, LocalResponseNorm, TernaryConv2d, TernaryDense, Flatten, Dense)
4851

4952
tl.logging.set_verbosity(tl.logging.DEBUG)
5053

54+
# Download data, and convert to TFRecord format, see ```tutorial_tfrecord.py```
5155
# prepare cifar10 data
5256
X_train, y_train, X_test, y_test = tl.files.load_cifar10_dataset(shape=(-1, 32, 32, 3), plotable=False)
5357

@@ -211,4 +215,3 @@ def accuracy(_logits, y_batch):
211215
n_iter += 1
212216
print(" test loss: {}".format(test_loss / n_iter))
213217
print(" test acc: {}".format(test_acc / n_iter))
214-

examples/quantized_net/tutorial_ternaryweight_mnist_cnn.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
# -*- coding: utf-8 -*-
33

44
import time
5+
56
import numpy as np
67
import tensorflow as tf
78
import tensorlayer as tl
9+
from tensorlayer.layers import (BatchNorm, Dense, Flatten, Input, MaxPool2d,
10+
TernaryConv2d, TernaryDense)
811
from tensorlayer.models import Model
9-
from tensorlayer.layers import (Input, TernaryConv2d, MaxPool2d, BatchNorm, Flatten, TernaryDense, Dense)
1012

1113
tl.logging.set_verbosity(tl.logging.DEBUG)
1214

@@ -96,4 +98,4 @@ def accuracy(_logits, y_batch):
9698
test_acc += np.mean(np.equal(np.argmax(_logits, 1), y_test_a))
9799
n_test_batch += 1
98100
print(" test loss: %f" % (test_loss / n_test_batch))
99-
print(" test acc: %f" % (test_acc / n_test_batch))
101+
print(" test acc: %f" % (test_acc / n_test_batch))

0 commit comments

Comments
 (0)