23
23
24
24
n_inputs = 28 # MNIST data input (img shape: 28*28)
25
25
n_steps = 28 # time steps
26
- n_hidden_unis = 128 # neurons in hidden layer
26
+ n_hidden_units = 128 # neurons in hidden layer
27
27
n_classes = 10 # MNIST classes (0-9 digits)
28
28
29
29
# tf Graph input
33
33
# Define weights
34
34
weights = {
35
35
# (28, 128)
36
- 'in' : tf .Variable (tf .random_normal ([n_inputs , n_hidden_unis ])),
36
+ 'in' : tf .Variable (tf .random_normal ([n_inputs , n_hidden_units ])),
37
37
# (128, 10)
38
- 'out' : tf .Variable (tf .random_normal ([n_hidden_unis , n_classes ]))
38
+ 'out' : tf .Variable (tf .random_normal ([n_hidden_units , n_classes ]))
39
39
}
40
40
biases = {
41
41
# (128, )
42
- 'in' : tf .Variable (tf .constant (0.1 , shape = [n_hidden_unis , ])),
42
+ 'in' : tf .Variable (tf .constant (0.1 , shape = [n_hidden_units , ])),
43
43
# (10, )
44
44
'out' : tf .Variable (tf .constant (0.1 , shape = [n_classes , ]))
45
45
}
@@ -57,13 +57,13 @@ def RNN(X, weights, biases):
57
57
# X_in = (128 batch * 28 steps, 128 hidden)
58
58
X_in = tf .matmul (X , weights ['in' ]) + biases ['in' ]
59
59
# X_in ==> (128 batch, 28 steps, 128 hidden)
60
- X_in = tf .reshape (X_in , [- 1 , n_steps , n_hidden_unis ])
60
+ X_in = tf .reshape (X_in , [- 1 , n_steps , n_hidden_units ])
61
61
62
62
# cell
63
63
##########################################
64
64
65
65
# basic LSTM Cell.
66
- lstm_cell = tf .nn .rnn_cell .BasicLSTMCell (n_hidden_unis , forget_bias = 1.0 , state_is_tuple = True )
66
+ lstm_cell = tf .nn .rnn_cell .BasicLSTMCell (n_hidden_units , forget_bias = 1.0 , state_is_tuple = True )
67
67
# lstm cell is divided into two parts (c_state, m_state)
68
68
_init_state = lstm_cell .zero_state (batch_size , dtype = tf .float32 )
69
69
0 commit comments