def test_convert_padding_direction(self):
    pad = 1
    left_pad = torch.LongTensor([[2, 3, 4, 5, 6], [1, 7, 8, 9, 10], [1, 1, 1, 11, 12]])
    right_pad = torch.LongTensor([[2, 3, 4, 5, 6], [7, 8, 9, 10, 1], [11, 12, 1, 1, 1]])
    self.assertAlmostEqual(right_pad, utils.convert_padding_direction(left_pad, pad, left_to_right=True))
    self.assertAlmostEqual(left_pad, utils.convert_padding_direction(right_pad, pad, right_to_left=True))
def test_convert_padding_direction(self):
    pad = 1
    left_pad = torch.LongTensor([[2, 3, 4, 5, 6], [1, 7, 8, 9, 10], [1, 1, 1, 11, 12]])
    right_pad = torch.LongTensor([[2, 3, 4, 5, 6], [7, 8, 9, 10, 1], [11, 12, 1, 1, 1]])
    self.assertAlmostEqual(right_pad, utils.convert_padding_direction(left_pad, pad, left_to_right=True))
    self.assertAlmostEqual(left_pad, utils.convert_padding_direction(right_pad, pad, right_to_left=True))