thuml / TransNorm

Code release for "Transferable Normalization: Towards Improving Transferability of Deep Neural Networks" (NeurIPS 2019)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question about the test mode

JiaoJinyang opened this issue · comments

Hi, thanks for sharing the code.
I am confused about the calculation of TransNorm in the test phase. The dimensions don't match when calculating the 'dis' of Line 165.
Thanks again for your nice work.

Thanks for paying attention to TransNorm. However, I cannot reproduce the problem that you mentioned. Since 'running_mean_source' , 'running_mean_target', 'running_var_source', 'running_var_target' are initialized and calculated with the same dimensions, the problem of dimensions mismatch should not occur. Would you mind printing out more information to debug it?

Thanks for your reply, but I'm still confused. The dimension of 'z' is the same with the 'input', but the dimension of 'dis' is the same with the 'num_features', their dimensions are different.

Thanks for your feedback. The shape of 'z' is [batch_size, num_features, width, height] while the shape of both 'dis' and the original 'alpha' is [num_features]. Thus, we reshape 'alpha' as [1, num_features, 1, 1]. According to the broadcasting mechanism of python, 'z' can directly multiply with 'alpha'. I hope this clarifies your question. Would you mind me closing this issue?

Thanks for the explanation. Thank you very much.