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

Method add_output_layer

tensorflowTUT/tf20_RNN2.2/full_code.py:78–85  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

76 lstm_cell, self.l_in_y, initial_state=self.cell_init_state, time_major=False)
77
78 def add_output_layer(self):
79 # shape = (batch * steps, cell_size)
80 l_out_x = tf.reshape(self.cell_outputs, [-1, self.cell_size], name='2_2D')
81 Ws_out = self._weight_variable([self.cell_size, self.output_size])
82 bs_out = self._bias_variable([self.output_size, ])
83 # shape = (batch * steps, output_size)
84 with tf.name_scope('Wx_plus_b'):
85 self.pred = tf.matmul(l_out_x, Ws_out) + bs_out
86
87 def compute_cost(self):
88 losses = tf.contrib.legacy_seq2seq.sequence_loss_by_example(

Callers 1

__init__Method · 0.95

Calls 2

_weight_variableMethod · 0.95
_bias_variableMethod · 0.95

Tested by

no test coverage detected