MCPcopy Create free account
hub / github.com/brightmart/text_classification / loop_function

Function loop_function

a06_Seq2seqWithAttention/a1_seq2seq.py:13–18  ·  view source on GitHub ↗
(prev, _)

Source from the content-addressed store, hash-verified

11 :return: A loop function
12 """
13 def loop_function(prev, _):
14 if output_projection is not None:
15 prev = tf.matmul(prev, output_projection[0]) + output_projection[1]
16 prev_symbol = tf.argmax(prev, 1) #得到对应的INDEX
17 emb_prev = tf.gather(embedding, prev_symbol) #得到这个INDEX对应的embedding
18 return emb_prev
19 return loop_function
20
21# RNN的解码部分。

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected