From 40dd50690937cb3f8adb644363b4830ecd7fcfcc Mon Sep 17 00:00:00 2001 From: Gustaf Rydholm Date: Fri, 5 Nov 2021 19:23:17 +0100 Subject: Format pad transform --- text_recognizer/data/transforms/pad.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'text_recognizer/data/transforms') diff --git a/text_recognizer/data/transforms/pad.py b/text_recognizer/data/transforms/pad.py index 82e4d54..1da4534 100644 --- a/text_recognizer/data/transforms/pad.py +++ b/text_recognizer/data/transforms/pad.py @@ -14,7 +14,7 @@ class Pad: def __call__(self, y: Tensor) -> Tensor: """Pads sequences with pad index if shorter than max len.""" - if y.shape[-1] < self.length: + if y.shape[-1] < self.max_len: pad_len = self.max_len - len(y) y = torch.cat((y, torch.LongTensor([self.pad_index] * pad_len))) return y[: self.max_len] -- cgit v1.2.3-70-g09d2