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

seg_ctc_ent_loss_log()函数的blank变量没有使用? #17

Open
fangshuiyun opened this issue Aug 9, 2023 · 1 comment
Open

seg_ctc_ent_loss_log()函数的blank变量没有使用? #17

fangshuiyun opened this issue Aug 9, 2023 · 1 comment

Comments

@fangshuiyun
Copy link

fangshuiyun commented Aug 9, 2023

def seg_ctc_ent_loss_log(pred, pred_len, token, token_len, uniform_mask, blank=0):
您好!我看到blank变量并没有在函数内部提及,而且我所设定的blank!=0,这是怎么回事?还是说不建议使用seg_ctc_ent_loss_log?使用ctc_ent_loss_log比较好,ctc_ent_loss_log的blank变量在函数内部有提及,可以改!
如能有回复,非常感谢!!!

@My-captain
Copy link

My-captain commented Nov 30, 2023

我觉得这里是有问题的,我是这样修改的,你可以参考

token_with_blank = torch.nn.functional.pad(target.unsqueeze(1), pad=(0, 1, 1, 0), mode='constant', value=blank).flatten()[1:]
token_with_blank = token_with_blank.contiguous()
length = token_with_blank.shape[0]
ctc_log_prob = ctc_log_prob[:, token_with_blank]

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