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

Implementation of S_m^k? #2

Open
BrandonHanx opened this issue Sep 3, 2021 · 0 comments
Open

Implementation of S_m^k? #2

BrandonHanx opened this issue Sep 3, 2021 · 0 comments

Comments

@BrandonHanx
Copy link

BrandonHanx commented Sep 3, 2021

for i in range(self.pars.compos_num):
prob.append(torch.nn.functional.softmax(self.compos_layer[i](detach_embedding), dim = 1))
prob0 = prob[i]
log_prob = -torch.log(prob0)
index = prob0.max(dim = 1, keepdim = True)[1]
supervise = torch.zeros_like(prob0).scatter_(1, index, 1.0)
supervise_loss = supervise_loss + torch.sum(log_prob*supervise)/x.size(0)
for i in range(self.pars.compos_num):
mod_x.append(soft_select(x_embedding, prob[i], self.pars.ensemble_num, self.pars.embed_dim))

There is a difference between your paper and your code.
According to this code block, it seems like you didn't implement S_m^k. This causes C_m^k directly equals to T_m^k.

Please point me out if I were wrong.

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

1 participant