When trying to reproduce section 3.1 in the inclusion of discrete translation vocabulary in Neural MT in the paddle-paddle
I tried to create a static matrix that I would need to load into the seqToseq preparation seqToseq , for example:
>>> import numpy as np >>> x = np.random.rand(3,2) >>> x array([[ 0.64077103, 0.03278357], [ 0.47133411, 0.16309775], [ 0.63986919, 0.07130613]])
With the demonstration of seqToseq_net this matrix will need to be multiplied by the output of the attention level in gru_decoder_with_attention . Original demo:
def gru_decoder_with_attention(enc_vec, enc_proj, current_word): decoder_mem = memory(name='gru_decoder', size=decoder_size, boot_layer=decoder_boot)
The goal is to influence the level of attention by multiplying it by a static matrix:
def gru_decoder_with_attention(enc_vec, enc_proj, current_word): decoder_mem = memory(name='gru_decoder', size=decoder_size, boot_layer=decoder_boot)
I tried to view the code in Paddle/python/trainer_config_helps and went through all the demo code and I also asked the PaddlePaddle gitter . But I canβt find how to load a custom static matrix that does not need to be updated in the learning process and interact with one of the Paddle layers.
How to load matrix for changing attention level in seqToseq demo?
What should be some_sort_of_layer and some_sort_of_operation_layer in the above example?