def position_encoding_init(n_position: int, embedding_dim: int):
    position_enc = np.array([([(pos / np.power(10000, ((2 * (j // 2)) / embedding_dim))) for j in range(embedding_dim)] if (pos != 0) else np.zeros(embedding_dim)) for pos in range(n_position)])
    position_enc[1:, 0::2] = np.sin(position_enc[1:, 0::2])
    position_enc[1:, 1::2] = np.cos(position_enc[1:, 1::2])
    return torch.from_numpy(position_enc).type(torch.FloatTensor)
def position_encoding_init(n_position: int, embedding_dim: int):
    position_enc = np.array([([(pos / np.power(10000, ((2 * (j // 2)) / embedding_dim))) for j in range(embedding_dim)] if (pos != 0) else np.zeros(embedding_dim)) for pos in range(n_position)])
    position_enc[1:, 0::2] = np.sin(position_enc[1:, 0::2])
    position_enc[1:, 1::2] = np.cos(position_enc[1:, 1::2])
    return torch.from_numpy(position_enc).type(torch.FloatTensor)