qiufengyuyi / event_extraction

baidu aistudio event extraction competition

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

您好作者,请问这部分逻辑能稍微解释下吗?type_index_in_token_ids这个变量有点迷,

bupianlizhugui opened this issue · comments

type_head_tensor = tf.gather_nd(bert_embedding, type_index)

image

type_index_in_token_ids这个变量是存储了原始句子语料+标签索引后的len长度,每加一个标签长度都做存储。为啥和batch_ids有关系呢?

type_head_tensor = tf.gather_nd(bert_embedding, type_index)

image

type_index_in_token_ids这个变量是存储了原始句子语料+标签索引后的len长度,每加一个标签长度都做存储。为啥和batch_ids有关系呢?

这个就涉及到gather_nd的机制了,他需要从一个batch中的每条序列上去索引事件类型文本片段的开头cls在序列中的位置,所以要把batch_ids也放到type_index中