summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-11-05 19:23:17 +0100
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-11-05 19:23:17 +0100
commit40dd50690937cb3f8adb644363b4830ecd7fcfcc (patch)
tree322a83727dae1d25bada1a2acee5c929bb724647
parentc141f422d7c8c7569c2d7f87117fdaf3b6bbb461 (diff)
Format pad transform
-rw-r--r--text_recognizer/data/transforms/pad.py2
1 files changed, 1 insertions, 1 deletions
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]