        def roll(t):
            """Rolls a 1d tensor left by 1.

            [0, 1, 2, 3, 4] becomes [4, 0, 1, 2, 3]
            """
            return torch.cat((t[-1].unsqueeze(0), t[0:-1]), dim=0)
Rolls a 1d tensor left by 1.

[0, 1, 2, 3, 4] becomes [4, 0, 1, 2, 3]
fairseq/search.py