Skip to content

Commit

Permalink
Fix MultiHeadAttention in test_transformer_api.py.
Browse files Browse the repository at this point in the history
test=develop
  • Loading branch information
guoshengCS committed Aug 23, 2020
1 parent 48f97e1 commit 1beb075
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions python/paddle/fluid/tests/unittests/test_transformer_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import numpy as np
import paddle
import paddle.fluid as fluid
from paddle.nn.layer.transformer import MultiheadAttention, TransformerEncoderLayer, TransformerDecoderLayer, TransformerEncoder, TransformerDecoder, Transformer
from paddle.nn.layer.transformer import MultiHeadAttention, TransformerEncoderLayer, TransformerDecoderLayer, TransformerEncoder, TransformerDecoder, Transformer

import unittest

Expand Down Expand Up @@ -225,7 +225,7 @@ def multihead_attention_test_helper(self_attention, cache):
attn_mask = np.concatenate((attn_mask, attn_mask), axis=3)
need_weight, param_attr, bias_attr = False, None, None
# call paddle's function
multi_head_attn = MultiheadAttention(
multi_head_attn = MultiHeadAttention(
embed_dim, num_heads, attn_dropout, kdim, vdim, need_weight,
param_attr, bias_attr)
# construct cache object
Expand Down Expand Up @@ -298,7 +298,7 @@ def test_transformer_encoder_layer(self):
paddle.to_variable(src_mask)) # paddle.to_variable(src_mask))
# 4.numpy:
# paddle self attention
self_attn = MultiheadAttention(
self_attn = MultiHeadAttention(
d_model, n_head, dropout=attn_dropout)
attn_output = self_attn(
paddle.to_variable(src),
Expand Down Expand Up @@ -334,9 +334,9 @@ def test_transformer_decoder_layer(self):
source_length)).astype("float32")
memory_mask[0][0][0][0] = -1e9
for cache in [True, False]:
self_attn = MultiheadAttention(
self_attn = MultiHeadAttention(
d_model, n_head, dropout=attn_dropout)
cross_attn = MultiheadAttention(
cross_attn = MultiHeadAttention(
d_model, n_head, dropout=attn_dropout)

# paddle decoderlayer:
Expand Down

1 comment on commit 1beb075

@paddle-bot-old
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Congratulation! Your pull request passed all required CI. You could ask reviewer(s) to approve and merge. 🎉

Please sign in to comment.