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

Question about relative_coords_table buffer in Swin V2. #329

Open
BlueDruddigon opened this issue Aug 2, 2023 · 0 comments
Open

Question about relative_coords_table buffer in Swin V2. #329

BlueDruddigon opened this issue Aug 2, 2023 · 0 comments

Comments

@BlueDruddigon
Copy link

In Swin Transformer V2, as proposed using Log-Space CPB,

In the code implementation, log-spaced coordinates are generated when transferring across window sizes through relative_coords_table like in this code snippet.

relative_coords_table *= 8 # normalize to -8, 8
relative_coords_table = torch.sign(relative_coords_table) * torch.log2(
torch.abs(relative_coords_table) + 1.0) / np.log2(8)

I have two questions:

  • Does it mean to be 8 and np.log2(8) ? Why do you do that ?
  • And if I do not multiply relative_coords_table by 8 and remove the afterwards divided by np.log2(8), what has changed?
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