graykode / graykode/nlp-tutorial

BiLstm(tf) maybe have mistake

未关闭
#74 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Jupyter Notebook
星标
14.9k
派生
3.9k
PR 合并指标
30 天内没有已合并 PR

描述

calculate attention_score
`
# Attention
outputs = tf.concat([output[0], output[1]], 2) # output[0] : lstm_fw, output[1] : lstm_bw
outputs = tf.transpose(outputs, [1, 0, 2]) # [n_step, batch_size, n_hidden]
# 只用了最后一个步长的输出
final_hidden_state = outputs[-1]
output_all = tf.concat([output[0], output[1]], 2)
final_hidden_state = tf.expand_dims(final_hidden_state, 2)
attn_weights = tf.squeeze(tf.matmul(output_all, final_hidden_state), 2) `

贡献指南

打开贡献指南

调研方向

首先定位 BiLstm(tf) 的实现,并检查所示的 attention-score 计算,尤其是最终 hidden state 和张量维度。验证得到的 attention weights 是否符合双向 LSTM 预期的 attention 行为;如果确认存在所怀疑的错误,则解决并修正该错误后即视为完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
tensorflow
领域
machine-learning
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
20/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。