(self, inps, training=None, mask=None)
return outs
Input: [dec_inps, enc_outs]
    Mask: [dec_mask, enc_mask]

    Input shape: [[batch_size, seq_dec_len, hidden_dim],
                    (batch_size, seq_enc_len, hidden_dim)]
    Mask shape: [(batch_size, seq_dec_len), (batch_size, seq_enc_len)]
Input: [dec_inps, enc_outs]
    Mask: [dec_mask, enc_mask]
Input : [ dec_inps enc_outs ] Mask : [ dec_mask enc_mask ]
def call(self, inps, training=None, mask=None):
    '''
    Input: [dec_inps, enc_outs]
    Mask: [dec_mask, enc_mask]

    Input shape: [[batch_size, seq_dec_len, hidden_dim],
                    (batch_size, seq_enc_len, hidden_dim)]
    Mask shape: [(batch_size, seq_dec_len), (batch_size, seq_enc_len)]
    '''
    dec_inps, enc_outs = inps
    dec_inps = self.dec_embed_dense(dec_inps)
    enc_outs = self.enc_embed_dense(enc_outs)
    look_ahead_mask, enc_mask = mask
    # Self Attention
    self_attn_outs, _ = self.self_attn_layer((dec_inps, dec_inps, dec_inps),
                                             training=training,
                                             mask=look_ahead_mask)
    self_attn_outs = self.self_attn_dropout(self_attn_outs, training=training)
    self_attn_outs += dec_inps
    self_attn_outs = self.self_attn_norm(self_attn_outs)

    # Context Attention
    context_attn_outs, _ = self.context_attn_layer(
        (self_attn_outs, enc_outs, enc_outs), training=training, mask=enc_mask)
    context_attn_outs = self.context_attn_dropout(
        context_attn_outs, training=training)
    context_attn_outs += self_attn_outs
    context_attn_outs = self.context_attn_norm(context_attn_outs)

    # Position Wise Feed Forward
    feed_forward_outs = self.feed_forward_layer(context_attn_outs)
    feed_forward_outs = self.feed_forward_dropout(
        feed_forward_outs, training=training)
    feed_forward_outs = context_attn_outs + feed_forward_outs
    outs = self.feed_forward_norm(feed_forward_outs)

    return outs
def call ( self , inps , training = None , mask = None ) : dec_inps , enc_outs = inps dec_inps = self . dec_embed_dense ( dec_inps ) enc_outs = self . enc_embed_dense ( enc_outs ) look_ahead_mask , enc_mask = mask # Self Attention self_attn_outs , _ = self . self_attn_layer ( ( dec_inps , dec_inps , dec_inps ) , training = training , mask = look_ahead_mask ) self_attn_outs = self . self_attn_dropout ( self_attn_outs , training = training ) self_attn_outs += dec_inps self_attn_outs = self . self_attn_norm ( self_attn_outs ) # Context Attention context_attn_outs , _ = self . context_attn_layer ( ( self_attn_outs , enc_outs , enc_outs ) , training = training , mask = enc_mask ) context_attn_outs = self . context_attn_dropout ( context_attn_outs , training = training ) context_attn_outs += self_attn_outs context_attn_outs = self . context_attn_norm ( context_attn_outs ) # Position Wise Feed Forward feed_forward_outs = self . feed_forward_layer ( context_attn_outs ) feed_forward_outs = self . feed_forward_dropout ( feed_forward_outs , training = training ) feed_forward_outs = context_attn_outs + feed_forward_outs outs = self . feed_forward_norm ( feed_forward_outs ) return outs