Skip to content

Commit b772fe2

Browse files
committed
edited
1 parent 9f646c1 commit b772fe2

30 files changed

+38
-38
lines changed

tensorflowTUT/tensorflow11_build_network.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def add_layer(inputs, in_size, out_size, activation_function=None):
3434
# add output layer
3535
prediction = add_layer(l1, 10, 1, activation_function=None)
3636

37-
# the error between prediciton and real data
37+
# the error between prediction and real data
3838
loss = tf.reduce_mean(tf.reduce_sum(tf.square(ys - prediction),
3939
reduction_indices=[1]))
4040
train_step = tf.train.GradientDescentOptimizer(0.1).minimize(loss)

tensorflowTUT/tensorflow12_plut_result.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def add_layer(inputs, in_size, out_size, activation_function=None):
4343
# important step
4444
# tf.initialize_all_variables() no long valid from
4545
# 2017-03-02 if using tensorflow >= 0.12
46-
if int((tf.__version__).split('.')[1]) < 12:
46+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
4747
init = tf.initialize_all_variables()
4848
else:
4949
init = tf.global_variables_initializer()

tensorflowTUT/tensorflow7_variable.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
# tf.initialize_all_variables() no long valid from
2020
# 2017-03-02 if using tensorflow >= 0.12
21-
if int((tf.__version__).split('.')[1]) < 12:
21+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
2222
init = tf.initialize_all_variables()
2323
else:
2424
init = tf.global_variables_initializer()

tensorflowTUT/tf11_build_network/for_you_to_practice.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def add_layer(inputs, in_size, out_size, activation_function=None):
3030
# add output layer
3131

3232

33-
# the error between prediciton and real data
33+
# the error between prediction and real data
3434

3535
# important step
3636

tensorflowTUT/tf11_build_network/full_code.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ def add_layer(inputs, in_size, out_size, activation_function=None):
3737
# add output layer
3838
prediction = add_layer(l1, 10, 1, activation_function=None)
3939

40-
# the error between prediciton and real data
40+
# the error between prediction and real data
4141
loss = tf.reduce_mean(tf.reduce_sum(tf.square(ys-prediction), reduction_indices=[1]))
4242
train_step = tf.train.GradientDescentOptimizer(0.1).minimize(loss)
4343
# important step
4444
sess = tf.Session()
4545
# tf.initialize_all_variables() no long valid from
4646
# 2017-03-02 if using tensorflow >= 0.12
47-
if int((tf.__version__).split('.')[1]) < 12:
47+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
4848
init = tf.initialize_all_variables()
4949
else:
5050
init = tf.global_variables_initializer()

tensorflowTUT/tf12_plot_result/for_you_to_practice.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ def add_layer(inputs, in_size, out_size, activation_function=None):
3737
# add output layer
3838
prediction = add_layer(l1, 10, 1, activation_function=None)
3939

40-
# the error between prediciton and real data
40+
# the error between prediction and real data
4141
loss = tf.reduce_mean(tf.reduce_sum(tf.square(ys-prediction), reduction_indices=[1]))
4242
train_step = tf.train.GradientDescentOptimizer(0.1).minimize(loss)
4343
# important step
4444
sess= tf.Session()
4545
# tf.initialize_all_variables() no long valid from
4646
# 2017-03-02 if using tensorflow >= 0.12
47-
if int((tf.__version__).split('.')[1]) < 12:
47+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
4848
init = tf.initialize_all_variables()
4949
else:
5050
init = tf.global_variables_initializer()

tensorflowTUT/tf12_plot_result/full_code.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ def add_layer(inputs, in_size, out_size, activation_function=None):
3737
# add output layer
3838
prediction = add_layer(l1, 10, 1, activation_function=None)
3939

40-
# the error between prediciton and real data
40+
# the error between prediction and real data
4141
loss = tf.reduce_mean(tf.reduce_sum(tf.square(ys-prediction), reduction_indices=[1]))
4242
train_step = tf.train.GradientDescentOptimizer(0.1).minimize(loss)
4343
# important step
4444
sess = tf.Session()
4545
# tf.initialize_all_variables() no long valid from
4646
# 2017-03-02 if using tensorflow >= 0.12
47-
if int((tf.__version__).split('.')[1]) < 12:
47+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
4848
init = tf.initialize_all_variables()
4949
else:
5050
init = tf.global_variables_initializer()

tensorflowTUT/tf14_tensorboard/for_you_to_practice.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def add_layer(inputs, in_size, out_size, activation_function=None):
4040

4141
# tf.initialize_all_variables() no long valid from
4242
# 2017-03-02 if using tensorflow >= 0.12
43-
if int((tf.__version__).split('.')[1]) < 12:
43+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
4444
init = tf.initialize_all_variables()
4545
else:
4646
init = tf.global_variables_initializer()

tensorflowTUT/tf14_tensorboard/full_code.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ def add_layer(inputs, in_size, out_size, activation_function=None):
4747
sess = tf.Session()
4848

4949
# tf.train.SummaryWriter soon be deprecated, use following
50-
if int((tf.__version__).split('.')[1]) < 12: # tensorflow version < 0.12
50+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1: # tensorflow version < 0.12
5151
writer = tf.train.SummaryWriter('logs/', sess.graph)
5252
else: # tensorflow version >= 0.12
5353
writer = tf.summary.FileWriter("logs/", sess.graph)
5454

5555
# tf.initialize_all_variables() no long valid from
5656
# 2017-03-02 if using tensorflow >= 0.12
57-
if int((tf.__version__).split('.')[1]) < 12:
57+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
5858
init = tf.initialize_all_variables()
5959
else:
6060
init = tf.global_variables_initializer()

tensorflowTUT/tf15_tensorboard/for_you_to_practice.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def add_layer(inputs, in_size, out_size, activation_function=None):
5454
# important step
5555
# tf.initialize_all_variables() no long valid from
5656
# 2017-03-02 if using tensorflow >= 0.12
57-
if int((tf.__version__).split('.')[1]) < 12:
57+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
5858
init = tf.initialize_all_variables()
5959
else:
6060
init = tf.global_variables_initializer()

tensorflowTUT/tf15_tensorboard/full_code.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def add_layer(inputs, in_size, out_size, n_layer, activation_function=None):
1616
layer_name = 'layer%s' % n_layer
1717

1818
# for tensorflow version < 0.12
19-
if int((tf.__version__).split('.')[1]) < 12:
19+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
2020
with tf.name_scope(layer_name):
2121
with tf.name_scope('weights'):
2222
Weights = tf.Variable(tf.random_normal([in_size, out_size]), name='W')
@@ -68,7 +68,7 @@ def add_layer(inputs, in_size, out_size, n_layer, activation_function=None):
6868
with tf.name_scope('loss'):
6969
loss = tf.reduce_mean(tf.reduce_sum(tf.square(ys - prediction),
7070
reduction_indices=[1]))
71-
if int((tf.__version__).split('.')[1]) < 12: # tensorflow version < 0.12
71+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1: # tensorflow version < 0.12
7272
tf.scalar_summary('loss', loss)
7373
else: # tensorflow version >= 0.12
7474
tf.summary.scalar('loss', loss)
@@ -77,20 +77,20 @@ def add_layer(inputs, in_size, out_size, n_layer, activation_function=None):
7777
train_step = tf.train.GradientDescentOptimizer(0.1).minimize(loss)
7878

7979
sess = tf.Session()
80-
if int((tf.__version__).split('.')[1]) < 12: # tensorflow version < 0.12
80+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1: # tensorflow version < 0.12
8181
merged = tf.merge_all_summaries()
8282
else: # tensorflow version >= 0.12
8383
merged = tf.summary.merge_all()
8484

8585
# tf.train.SummaryWriter soon be deprecated, use following
86-
if int((tf.__version__).split('.')[1]) < 12: # tensorflow version < 0.12
86+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1: # tensorflow version < 0.12
8787
writer = tf.train.SummaryWriter('logs/', sess.graph)
8888
else: # tensorflow version >= 0.12
8989
writer = tf.summary.FileWriter("logs/", sess.graph)
9090

9191
# tf.initialize_all_variables() no long valid from
9292
# 2017-03-02 if using tensorflow >= 0.12
93-
if int((tf.__version__).split('.')[1]) < 12:
93+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
9494
init = tf.initialize_all_variables()
9595
else:
9696
init = tf.global_variables_initializer()

tensorflowTUT/tf16_classification/for_you_to_practice.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def add_layer(inputs, in_size, out_size, activation_function=None, ):
3535
# important step
3636
# tf.initialize_all_variables() no long valid from
3737
# 2017-03-02 if using tensorflow >= 0.12
38-
if int((tf.__version__).split('.')[1]) < 12:
38+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
3939
init = tf.initialize_all_variables()
4040
else:
4141
init = tf.global_variables_initializer()

tensorflowTUT/tf16_classification/full_code.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def compute_accuracy(v_xs, v_ys):
4747
# important step
4848
# tf.initialize_all_variables() no long valid from
4949
# 2017-03-02 if using tensorflow >= 0.12
50-
if int((tf.__version__).split('.')[1]) < 12:
50+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
5151
init = tf.initialize_all_variables()
5252
else:
5353
init = tf.global_variables_initializer()

tensorflowTUT/tf17_dropout/for_you_to_practice.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def add_layer(inputs, in_size, out_size, layer_name, activation_function=None, )
5454

5555
# tf.initialize_all_variables() no long valid from
5656
# 2017-03-02 if using tensorflow >= 0.12
57-
if int((tf.__version__).split('.')[1]) < 12:
57+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
5858
init = tf.initialize_all_variables()
5959
else:
6060
init = tf.global_variables_initializer()

tensorflowTUT/tf17_dropout/full_code.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def add_layer(inputs, in_size, out_size, layer_name, activation_function=None, )
5858

5959
# tf.initialize_all_variables() no long valid from
6060
# 2017-03-02 if using tensorflow >= 0.12
61-
if int((tf.__version__).split('.')[1]) < 12:
61+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
6262
init = tf.initialize_all_variables()
6363
else:
6464
init = tf.global_variables_initializer()

tensorflowTUT/tf18_CNN2/for_you_to_practice.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def max_pool_2x2(x):
5151
# important step
5252
# tf.initialize_all_variables() no long valid from
5353
# 2017-03-02 if using tensorflow >= 0.12
54-
if int((tf.__version__).split('.')[1]) < 12:
54+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
5555
init = tf.initialize_all_variables()
5656
else:
5757
init = tf.global_variables_initializer()

tensorflowTUT/tf18_CNN2/full_code.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def max_pool_2x2(x):
6060
# important step
6161
# tf.initialize_all_variables() no long valid from
6262
# 2017-03-02 if using tensorflow >= 0.12
63-
if int((tf.__version__).split('.')[1]) < 12:
63+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
6464
init = tf.initialize_all_variables()
6565
else:
6666
init = tf.global_variables_initializer()

tensorflowTUT/tf18_CNN3/for_you_to_practice.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ def max_pool_2x2(x):
6060
# important step
6161
# tf.initialize_all_variables() no long valid from
6262
# 2017-03-02 if using tensorflow >= 0.12
63-
if int((tf.__version__).split('.')[1]) < 12:
63+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
6464
init = tf.initialize_all_variables()
6565
else:
6666
init = tf.global_variables_initializer()

tensorflowTUT/tf18_CNN3/full_code.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def max_pool_2x2(x):
7979
# important step
8080
# tf.initialize_all_variables() no long valid from
8181
# 2017-03-02 if using tensorflow >= 0.12
82-
if int((tf.__version__).split('.')[1]) < 12:
82+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
8383
init = tf.initialize_all_variables()
8484
else:
8585
init = tf.global_variables_initializer()

tensorflowTUT/tf19_saver.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
# tf.initialize_all_variables() no long valid from
1919
# 2017-03-02 if using tensorflow >= 0.12
20-
# if int((tf.__version__).split('.')[1]) < 12:
20+
# if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
2121
# init = tf.initialize_all_variables()
2222
# else:
2323
# init = tf.global_variables_initializer()

tensorflowTUT/tf20_RNN2.2/for_practicing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def _bias_variable(self, shape, name='biases'):
103103

104104
# tf.initialize_all_variables() no long valid from
105105
# 2017-03-02 if using tensorflow >= 0.12
106-
if int((tf.__version__).split('.')[1]) < 12:
106+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
107107
init = tf.initialize_all_variables()
108108
else:
109109
init = tf.global_variables_initializer()

tensorflowTUT/tf20_RNN2.2/full_code.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ def _bias_variable(self, shape, name='biases'):
119119
writer = tf.train.SummaryWriter("logs", sess.graph)
120120
# tf.initialize_all_variables() no long valid from
121121
# 2017-03-02 if using tensorflow >= 0.12
122-
if int((tf.__version__).split('.')[1]) < 12:
122+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
123123
init = tf.initialize_all_variables()
124124
else:
125125
init = tf.global_variables_initializer()

tensorflowTUT/tf20_RNN2/for_you_to_practice.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def RNN(X, weights, biases):
7171
with tf.Session() as sess:
7272
# tf.initialize_all_variables() no long valid from
7373
# 2017-03-02 if using tensorflow >= 0.12
74-
if int((tf.__version__).split('.')[1]) < 12:
74+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
7575
init = tf.initialize_all_variables()
7676
else:
7777
init = tf.global_variables_initializer()

tensorflowTUT/tf20_RNN2/full_code.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def RNN(X, weights, biases):
101101
with tf.Session() as sess:
102102
# tf.initialize_all_variables() no long valid from
103103
# 2017-03-02 if using tensorflow >= 0.12
104-
if int((tf.__version__).split('.')[1]) < 12:
104+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
105105
init = tf.initialize_all_variables()
106106
else:
107107
init = tf.global_variables_initializer()

tensorflowTUT/tf21_autoencoder/for_practicing.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def decoder(x):
7474
with tf.Session() as sess:
7575
# tf.initialize_all_variables() no long valid from
7676
# 2017-03-02 if using tensorflow >= 0.12
77-
if int((tf.__version__).split('.')[1]) < 12:
77+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
7878
init = tf.initialize_all_variables()
7979
else:
8080
init = tf.global_variables_initializer()

tensorflowTUT/tf21_autoencoder/full_code.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ def decoder(x):
152152
with tf.Session() as sess:
153153
# tf.initialize_all_variables() no long valid from
154154
# 2017-03-02 if using tensorflow >= 0.12
155-
if int((tf.__version__).split('.')[1]) < 12:
155+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
156156
init = tf.initialize_all_variables()
157157
else:
158158
init = tf.global_variables_initializer()

tensorflowTUT/tf22_scope/tf22_RNN_scope.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def _bias_variable(shape, name='biases'):
113113
test_rnn2 = RNN(test_config)
114114
# tf.initialize_all_variables() no long valid from
115115
# 2017-03-02 if using tensorflow >= 0.12
116-
if int((tf.__version__).split('.')[1]) < 12:
116+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
117117
init = tf.initialize_all_variables()
118118
else:
119119
init = tf.global_variables_initializer()

tensorflowTUT/tf22_scope/tf22_scope.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
with tf.Session() as sess:
3737
# tf.initialize_all_variables() no long valid from
3838
# 2017-03-02 if using tensorflow >= 0.12
39-
if int((tf.__version__).split('.')[1]) < 12:
39+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
4040
init = tf.initialize_all_variables()
4141
else:
4242
init = tf.global_variables_initializer()

tensorflowTUT/tf23_BN/tf23_BN.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def mean_var_with_update():
154154
train_op_norm, cost_norm, layers_inputs_norm = built_net(xs, ys, norm=True) # with BN
155155

156156
sess = tf.Session()
157-
if int((tf.__version__).split('.')[1]) < 12:
157+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
158158
init = tf.initialize_all_variables()
159159
else:
160160
init = tf.global_variables_initializer()

tensorflowTUT/tf5_example2/full_code.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
sess = tf.Session()
3131
# tf.initialize_all_variables() no long valid from
3232
# 2017-03-02 if using tensorflow >= 0.12
33-
if int((tf.__version__).split('.')[1]) < 12:
33+
if int((tf.__version__).split('.')[1]) < 12 and int((tf.__version__).split('.')[0]) < 1:
3434
init = tf.initialize_all_variables()
3535
else:
3636
init = tf.global_variables_initializer()

0 commit comments

Comments
 (0)