You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classAttentionPoolingLayer(Layer):
def__init__(self, att_hidden_units=(256, 128, 64)):
super(AttentionPoolingLayer, self).__init__()
self.att_hidden_units=att_hidden_unitsself.local_att=LocalActivationUnit(self.att_hidden_units)
defcall(self, inputs):
# keys: B x len x emb_dim, queries: B x 1 x emb_dimqueries, keys=inputs# 获取行为序列embedding的mask矩阵,将Embedding矩阵中的非零元素设置成True,key_masks=tf.not_equal(keys[:,:,0], 0) # B x len
key_masks = tf.not_equal(keys[:,:,0], 0) # B x len,为啥是tf.not_equal(keys[:,:,0], 0)的值,当做key_masks呢?百思不得其解
The text was updated successfully, but these errors were encountered:
请问一下各路大神,以下代码细节:
key_masks = tf.not_equal(keys[:,:,0], 0) # B x len,为啥是
tf.not_equal(keys[:,:,0], 0)
的值,当做key_masks
呢?百思不得其解The text was updated successfully, but these errors were encountered: