text
text copied to clipboard
Add padding direction
give small flexibility to pad transformer
@SM-Jang Thanks for the addition! A couple of notes:
- Can you refer to our style guide and make sure the code passes our linting?
- Can you add a brief note on the motivation behind this addition?
-
Can you refer to our style guide and make sure the code passes our linting? Okay, I check flake8 and I follow change the name as begin:bool, default=False To verify it, i modify the unittest and pass it all (test/torchtext_unittest/test_transfoms.py)
-
Can you add a brief note on the motivation behind this addition? When I work for modeling timeserise, I have to pad on begin or end. The old PadTransform only give left pad... So I have to use torch.nn.functional.pad()
ex) ... self.query_transformer = Sequential( # Truncate(10), VocabTransform(query_vocab), ToTensor(), ) ... x = query_transformer(x) x = torch.nn.functional.pad(x, (0, pad_amount), value=self.pad_value) ...
That's why