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

Additional Log in the softmax function #12

Open
ATAboukhadra opened this issue Jul 24, 2021 · 2 comments
Open

Additional Log in the softmax function #12

ATAboukhadra opened this issue Jul 24, 2021 · 2 comments

Comments

@ATAboukhadra
Copy link

ATAboukhadra commented Jul 24, 2021

Hi,

I just have a question, why did you use an additional log before the softmax function in st.py loss on one input but not the other?

def forward(self, out_s, out_t):
		loss = F.kl_div(F.log_softmax(out_s/self.T, dim=1),
						F.softmax(out_t/self.T, dim=1),
						reduction='batchmean') * self.T * self.T

		return loss

@nguyenvulong
Copy link

nguyenvulong commented Jul 4, 2022

Yeah it is strange that is has the log there. I found another implementation that did not use log but softmax only for both Teacher and Student.

As you might have already known it, when we modify the F.log_softmax(out_s/self.T, dim=1) in to F.softmax(out_s/self.T, dim=1), the KD output is negative.

Do you have any ideas why?

image

@nguyenvulong
Copy link

I asked another researcher and here is the answer yoshitomo-matsubara/torchdistill#233

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