MCPcopy Create free account
hub / github.com/PaddlePaddle/Research / graph_decoder

Function graph_decoder

NLP/ACL2020-GraphSum/src/models/decoder.py:308–378  ·  view source on GitHub ↗

The decoder is composed of a stack of identical decoder_layer layers. :param dec_input: (batch_size, tgt_len, emb_dim) :param enc_words_output: (batch_size, n_blocks, n_tokens, emb_dim) :param enc_sents_output: (batch_size, n_blocks, emb_dim) :param dec_slf_attn_bias: (batch

(dec_input,
                  enc_words_output,
                  enc_sents_output,
                  dec_slf_attn_bias,
                  dec_enc_words_attn_bias,
                  dec_enc_sents_attn_bias,
                  graph_attn_bias,
                  pos_win,
                  n_layer,
                  n_head,
                  d_key,
                  d_value,
                  d_model,
                  d_inner_hid,
                  prepostprocess_dropout,
                  attention_dropout,
                  relu_dropout,
                  hidden_act,
                  preprocess_cmd,
                  postprocess_cmd,
                  caches=None,
                  gather_idx=None,
                  param_initializer=None,
                  name='graph_decoder')

Source from the content-addressed store, hash-verified

306
307
308def graph_decoder(dec_input,
309 enc_words_output,
310 enc_sents_output,
311 dec_slf_attn_bias,
312 dec_enc_words_attn_bias,
313 dec_enc_sents_attn_bias,
314 graph_attn_bias,
315 pos_win,
316 n_layer,
317 n_head,
318 d_key,
319 d_value,
320 d_model,
321 d_inner_hid,
322 prepostprocess_dropout,
323 attention_dropout,
324 relu_dropout,
325 hidden_act,
326 preprocess_cmd,
327 postprocess_cmd,
328 caches=None,
329 gather_idx=None,
330 param_initializer=None,
331 name='graph_decoder'):
332 """
333 The decoder is composed of a stack of identical decoder_layer layers.
334 :param dec_input: (batch_size, tgt_len, emb_dim)
335 :param enc_words_output: (batch_size, n_blocks, n_tokens, emb_dim)
336 :param enc_sents_output: (batch_size, n_blocks, emb_dim)
337 :param dec_slf_attn_bias: (batch_size, n_head, tgt_len, tgt_len)
338 :param dec_enc_words_attn_bias: (batch_size, n_blocks, n_head, tgt_len, n_tokens)
339 :param dec_enc_sents_attn_bias: (batch_size, n_head, tgt_len, n_blocks)
340 :param graph_attn_bias: (batch_size, n_head, n_blocks, n_blocks)
341 :return:
342 """
343 for i in range(n_layer):
344 # (batch_size, tgt_len, emb_dim)
345 dec_output = graph_decoder_layer(
346 dec_input=dec_input,
347 enc_words_output=enc_words_output,
348 enc_sents_output=enc_sents_output,
349 slf_attn_bias=dec_slf_attn_bias,
350 dec_enc_words_attn_bias=dec_enc_words_attn_bias,
351 dec_enc_sents_attn_bias=dec_enc_sents_attn_bias,
352 graph_attn_bias=graph_attn_bias,
353 pos_win=pos_win,
354 n_head=n_head,
355 d_key=d_key,
356 d_value=d_value,
357 d_model=d_model,
358 d_inner_hid=d_inner_hid,
359 prepostprocess_dropout=prepostprocess_dropout,
360 attention_dropout=attention_dropout,
361 relu_dropout=relu_dropout,
362 hidden_act=hidden_act,
363 preprocess_cmd=preprocess_cmd,
364 postprocess_cmd=postprocess_cmd,
365 cache=None if caches is None else caches[i],

Callers 1

decodeMethod · 0.90

Calls 1

graph_decoder_layerFunction · 0.70

Tested by

no test coverage detected