def test_make_positions(self):
    pad = 1
    left_pad_input = torch.LongTensor([[9, 9, 9, 9, 9], [1, 9, 9, 9, 9], [1, 1, 1, 9, 9]])
    left_pad_output = torch.LongTensor([[2, 3, 4, 5, 6], [1, 2, 3, 4, 5], [1, 1, 1, 2, 3]])
    right_pad_input = torch.LongTensor([[9, 9, 9, 9, 9], [9, 9, 9, 9, 1], [9, 9, 1, 1, 1]])
    right_pad_output = torch.LongTensor([[2, 3, 4, 5, 6], [2, 3, 4, 5, 1], [2, 3, 1, 1, 1]])
    self.assertAlmostEqual(left_pad_output, utils.make_positions(left_pad_input, pad))
    self.assertAlmostEqual(right_pad_output, utils.make_positions(right_pad_input, pad))
def test_make_positions(self):
    pad = 1
    left_pad_input = torch.LongTensor([[9, 9, 9, 9, 9], [1, 9, 9, 9, 9], [1, 1, 1, 9, 9]])
    left_pad_output = torch.LongTensor([[2, 3, 4, 5, 6], [1, 2, 3, 4, 5], [1, 1, 1, 2, 3]])
    right_pad_input = torch.LongTensor([[9, 9, 9, 9, 9], [9, 9, 9, 9, 1], [9, 9, 1, 1, 1]])
    right_pad_output = torch.LongTensor([[2, 3, 4, 5, 6], [2, 3, 4, 5, 1], [2, 3, 1, 1, 1]])
    self.assertAlmostEqual(left_pad_output, utils.make_positions(left_pad_input, pad))
    self.assertAlmostEqual(right_pad_output, utils.make_positions(right_pad_input, pad))