We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
if self.has_pos_embed: self.pos_embed = nn.Parameter(data=get_sinusoid_encoding(n_position=num_patches, d_hid=embed_dim), requires_grad=False) self.pos_drop = nn.Dropout(p=drop_rate)
Hello, is get_sinusoid_encoding used? Can I remove it if I don't use it? This function doesn't seem to be defined.
The text was updated successfully, but these errors were encountered:
https://github.com/yitu-opensource/T2T-ViT/blob/88afb7cf30b603703c02b6e29c06be23c49cf6a2/models/transformer_block.py#L78
def get_sinusoid_encoding(n_position, d_hid): ''' Sinusoid position encoding table ''' def get_position_angle_vec(position): return [position / np.power(10000, 2 * (hid_j // 2) / d_hid) for hid_j in range(d_hid)] sinusoid_table = np.array([get_position_angle_vec(pos_i) for pos_i in range(n_position)]) sinusoid_table[:, 0::2] = np.sin(sinusoid_table[:, 0::2]) # dim 2i sinusoid_table[:, 1::2] = np.cos(sinusoid_table[:, 1::2]) # dim 2i+1 return torch.FloatTensor(sinusoid_table).unsqueeze(0)
Sorry, something went wrong.
No branches or pull requests
Hello, is get_sinusoid_encoding used? Can I remove it if I don't use it? This function doesn't seem to be defined.
The text was updated successfully, but these errors were encountered: