luopeixiang / im2latex

Pytorch implemention of Deep CNN Encoder + LSTM Decoder with Attention for Image to Latex
MIT License
185 stars 49 forks source link

Something wrong in the Positional Embedding code? #10

Open YongWookHa opened 4 years ago

YongWookHa commented 4 years ago

https://github.com/luopeixiang/im2latex/blob/cd80800b70621847315e09fc9b760b5281f1a9f7/model/position_embedding.py#L43

I found your code little bit strange. I think this code should have been changed like below.

sinusoid[:,::2] = torch.sin(scaled_time)
sinusoid[:,1::2] = torch.cos(scaled_time)

Do I misunderstand your code?