- self.train_input = torch.cat([torch.tensor([char2id(c) for c in s + " "*(len_max-len(s))] for s in train_sequences)], 0)
- self.test_input = torch.cat([torch.tensor([char2id(c) for c in s + " "*(len_max-len(s))] for s in test_sequences)], 0)
+ self.train_input = torch.cat(
+ [
+ torch.tensor(
+ [char2id(c) for c in s + " " * (len_max - len(s))]
+ for s in train_sequences
+ )
+ ],
+ 0,
+ )
+ self.test_input = torch.cat(
+ [
+ torch.tensor(
+ [char2id(c) for c in s + " " * (len_max - len(s))]
+ for s in test_sequences
+ )
+ ],
+ 0,
+ )