概述
IRNET 的 memory augmented pointer network
选择一个列
c
c
c 的概率为:
p
(
a
i
=
S
E
L
E
C
T
C
O
L
U
M
N
[
c
]
∣
x
,
s
,
a
<
i
)
=
p
(
M
E
M
∣
x
,
s
,
a
<
i
)
p
(
c
∣
x
,
s
,
a
<
i
,
M
E
M
)
+
p
(
S
∣
x
,
s
,
a
<
i
)
p
(
c
∣
x
,
s
,
a
<
i
,
S
)
p
(
M
E
M
∣
x
,
s
,
a
<
i
)
=
sigmod
(
w
m
⊤
v
i
)
p
(
S
∣
x
,
s
,
a
<
i
)
=
1
−
p
(
MEM
∣
x
,
s
,
a
<
i
)
p
(
c
∣
x
,
s
,
a
<
i
,
M
E
M
)
∝
exp
(
v
i
⊤
E
c
m
)
p
(
c
∣
x
,
s
,
a
<
i
,
S
)
∝
exp
(
v
i
⊤
E
c
s
)
begin{aligned} pleft(a_{i}=mathrm{SELECTCOLUMN}[c] mid x, s, a_{<i}right)&= pleft(mathrm{MEM} mid x, s, a_{<i}right) pleft(c mid x, s, a_{<i}, mathrm{MEM}right) \ &+pleft(mathrm{~S} mid x, s, a_{<i}right) pleft(c mid x, s, a_{<i}, mathrm{~S}right) \ pleft(mathrm{MEM} mid x, s, a_{<i}right)&=operatorname{sigmod}left(boldsymbol{w}_{m}^{top} boldsymbol{v}_{i}right) \ pleft(mathrm{~S} mid x, s, a_{<i}right)&=1-pleft(operatorname{MEM} mid x, s, a_{<i}right) \ pleft(c mid x, s, a_{<i}, mathrm{MEM}right) &propto exp left(boldsymbol{v}_{i}^{top} boldsymbol{E}_{c}^{m}right) \ pleft(c mid x, s, a_{<i}, mathrm{~S}right)& propto exp left(boldsymbol{v}_{i}^{top} boldsymbol{E}_{c}^{s}right) end{aligned}
p(ai=SELECTCOLUMN[c]∣x,s,a<i)p(MEM∣x,s,a<i)p( S∣x,s,a<i)p(c∣x,s,a<i,MEM)p(c∣x,s,a<i, S)=p(MEM∣x,s,a<i)p(c∣x,s,a<i,MEM)+p( S∣x,s,a<i)p(c∣x,s,a<i, S)=sigmod(wm⊤vi)=1−p(MEM∣x,s,a<i)∝exp(vi⊤Ecm)∝exp(vi⊤Ecs)
其中,
signal | meaning |
---|---|
S S S | selecting from schema |
M E M MEM MEM | selecting from memory |
H x H_x Hx | NL encoder takes x x x as input and encodes x x x into a sequence of hidden states H x H_x Hx |
v i v_i vi | context vector that is obtained by performing an attention over H x H_x Hx |
E c m {E}_{c}^{m} Ecm | the embedding of columns in memory |
E c s {E}_{c}^{s} Ecs | the embedding of columns that are never selected |
w m w_m wm | trainable parameter |
table_appear_mask_val = torch.from_numpy(table_appear_mask)
if self.cuda:
table_appear_mask_val = table_appear_mask_val.cuda()
if self.use_column_pointer:
gate = F.sigmoid(self.prob_att(att_t))
weights = self.column_pointer_net(src_encodings=table_embedding, query_vec=att_t.unsqueeze(0),
src_token_mask=None) * table_appear_mask_val * gate + self.column_pointer_net(
src_encodings=table_embedding, query_vec=att_t.unsqueeze(0),
src_token_mask=None) * (1 - table_appear_mask_val) * (1 - gate)
else:
weights = self.column_pointer_net(src_encodings=table_embedding, query_vec=att_t.unsqueeze(0),
src_token_mask=batch.table_token_mask)
weights.data.masked_fill_(batch.table_token_mask.bool(), -float('inf'))
column_attention_weights = F.softmax(weights, dim=-1)
最后
以上就是开心曲奇为你收集整理的IRNET 的 memory augmented pointer network的全部内容,希望文章能够帮你解决IRNET 的 memory augmented pointer network所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复