MCPcopy Create free account
hub / github.com/MorvanZhou/tutorials / add_input_layer

Method add_input_layer

tensorflowTUT/tf20_RNN2.2/full_code.py:59–69  ·  view source on GitHub ↗
(self,)

Source from the content-addressed store, hash-verified

57 self.train_op = tf.train.AdamOptimizer(LR).minimize(self.cost)
58
59 def add_input_layer(self,):
60 l_in_x = tf.reshape(self.xs, [-1, self.input_size], name='2_2D') # (batch*n_step, in_size)
61 # Ws (in_size, cell_size)
62 Ws_in = self._weight_variable([self.input_size, self.cell_size])
63 # bs (cell_size, )
64 bs_in = self._bias_variable([self.cell_size,])
65 # l_in_y = (batch * n_steps, cell_size)
66 with tf.name_scope('Wx_plus_b'):
67 l_in_y = tf.matmul(l_in_x, Ws_in) + bs_in
68 # reshape l_in_y ==> (batch, n_steps, cell_size)
69 self.l_in_y = tf.reshape(l_in_y, [-1, self.n_steps, self.cell_size], name='2_3D')
70
71 def add_cell(self):
72 lstm_cell = tf.contrib.rnn.BasicLSTMCell(self.cell_size, forget_bias=1.0, state_is_tuple=True)

Callers 1

__init__Method · 0.95

Calls 2

_weight_variableMethod · 0.95
_bias_variableMethod · 0.95

Tested by

no test coverage detected