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

Method __init__

tensorflowTUT/tf20_RNN2.2/full_code.py:39–57  ·  view source on GitHub ↗
(self, n_steps, input_size, output_size, cell_size, batch_size)

Source from the content-addressed store, hash-verified

37
38class LSTMRNN(object):
39 def __init__(self, n_steps, input_size, output_size, cell_size, batch_size):
40 self.n_steps = n_steps
41 self.input_size = input_size
42 self.output_size = output_size
43 self.cell_size = cell_size
44 self.batch_size = batch_size
45 with tf.name_scope('inputs'):
46 self.xs = tf.placeholder(tf.float32, [None, n_steps, input_size], name='xs')
47 self.ys = tf.placeholder(tf.float32, [None, n_steps, output_size], name='ys')
48 with tf.variable_scope('in_hidden'):
49 self.add_input_layer()
50 with tf.variable_scope('LSTM_cell'):
51 self.add_cell()
52 with tf.variable_scope('out_hidden'):
53 self.add_output_layer()
54 with tf.name_scope('cost'):
55 self.compute_cost()
56 with tf.name_scope('train'):
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)

Callers

nothing calls this directly

Calls 4

add_input_layerMethod · 0.95
add_cellMethod · 0.95
add_output_layerMethod · 0.95
compute_costMethod · 0.95

Tested by

no test coverage detected