Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

你好,在log norm step的时候,我的理解是这样的,不知道有没有错,望指正 #6

Closed
635566381 opened this issue Aug 2, 2019 · 2 comments

Comments

@635566381
Copy link

` def log_norm_step(self, inputs, states):
"""递归计算归一化因子
要点:1、递归计算;2、用logsumexp避免溢出。
技巧:通过expand_dims来对齐张量。
"""
states = K.expand_dims(states[0], 2)
inputs = K.expand_dims(inputs, 2)
trans = K.expand_dims(self.trans, 0)

    output = K.logsumexp(states+trans+inputs, 1)
    return output, [output] #`

这里上个时刻的结果 + 转移矩阵 + 这个时刻标签的分值然后再取e指数吧,望指正

@635566381
Copy link
Author

这里上个时刻的结果 + 转移矩阵 + 这个时刻标签的分值然后再取e指数求和吧,望指正

@bojone
Copy link
Owner

bojone commented Aug 2, 2019

你的理解是错的。

1、请认真理解logsumexp的含义(log + sum + exp);
2、请认真理解 https://kexue.fm/archives/5542 中的(4),(5),(9)式,认真思考(9)式取对数后会是怎么样,不要自行幻想。

@bojone bojone closed this as completed Sep 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants