def __init__(self, max_length, pos_hidden_dim):
    super(SketchSinPositionEmbedding, self).__init__()
    self.pos_embedding_matrix = torch.zeros(max_length, pos_hidden_dim)
    pos_vector = torch.arange(max_length).view(max_length, 1).type(torch.float)
    dim_vector = (torch.arange(pos_hidden_dim).type(torch.float) + 1.0)
    self.pos_embedding_matrix[:, ::2] = torch.sin((pos_vector / (dim_vector[::2] / 2).view(1, (- 1))))
    self.pos_embedding_matrix[:, 1::2] = torch.cos((pos_vector / ((dim_vector[1::2] - 1) / 2).view(1, (- 1))))
def __init__(self, max_length, pos_hidden_dim):
    super(SketchSinPositionEmbedding, self).__init__()
    self.pos_embedding_matrix = torch.zeros(max_length, pos_hidden_dim)
    pos_vector = torch.arange(max_length).view(max_length, 1).type(torch.float)
    dim_vector = (torch.arange(pos_hidden_dim).type(torch.float) + 1.0)
    self.pos_embedding_matrix[:, ::2] = torch.sin((pos_vector / (dim_vector[::2] / 2).view(1, (- 1))))
    self.pos_embedding_matrix[:, 1::2] = torch.cos((pos_vector / ((dim_vector[1::2] - 1) / 2).view(1, (- 1))))