Exemple #1
0
 def parse_batch(self: TrainerType,
                 batch: List[torch.Tensor]) -> Tuple[torch.Tensor, ...]:
     inputs = to_device(batch[0],
                        device=self.device,
                        non_blocking=self.non_blocking)
     targets = to_device(batch[1],
                         device=self.device,
                         non_blocking=self.non_blocking)
     return inputs, targets
Exemple #2
0
 def parse_batch(self,
                 batch: List[torch.Tensor]) -> Tuple[torch.Tensor, ...]:
     inputs = to_device(batch[0],
                        device=self.device,
                        non_blocking=self.non_blocking)
     lengths = to_device(batch[1],
                         device=self.device,
                         non_blocking=self.non_blocking)
     return inputs, inputs, lengths
Exemple #3
0
 def parse_batch(self,
                 batch: List[torch.Tensor]) -> Tuple[torch.Tensor, ...]:
     inputs = to_device(batch[0],
                        device=self.device,
                        non_blocking=self.non_blocking)
     target = to_device(batch[1],
                        device=self.device,
                        non_blocking=self.non_blocking)
     domain = to_device(batch[2],
                        device=self.device,
                        non_blocking=self.non_blocking)
     return inputs, target, domain
Exemple #4
0
 def parse_batch(self,
                 batch: List[torch.Tensor]) -> Tuple[torch.Tensor, ...]:
     inputs = to_device(batch[0],
                        device=self.device,
                        non_blocking=self.non_blocking)
     target = to_device(batch[1],
                        device=self.device,
                        non_blocking=self.non_blocking)
     segms = to_device(batch[2],
                       device=self.device,
                       non_blocking=self.non_blocking)
     attention_masks = to_device(batch[3],
                                 device=self.device,
                                 non_blocking=self.non_blocking)
     return inputs, target, segms, attention_masks
 def parse_batch(
         self,
         batch: List[torch.Tensor]) -> Tuple[torch.Tensor, ...]:
     inputs, input_lengths, targets, target_lengths = map(
         lambda b: to_device(b, device=self.device,
                             non_blocking=self.non_blocking), batch)
     return inputs, input_lengths, targets, target_lengths
Exemple #6
0
 def parse_batch(self,
                 batch: List[torch.Tensor]) -> Tuple[torch.Tensor, ...]:
     inputs = to_device(batch[0],
                        device=self.device,
                        non_blocking=self.non_blocking)
     titles = to_device(batch[1],
                        device=self.device,
                        non_blocking=self.non_blocking)
     targets = to_device(batch[2],
                         device=self.device,
                         non_blocking=self.non_blocking)
     len_inputs = to_device(batch[3],
                            device=self.device,
                            non_blocking=self.non_blocking)
     len_titles = to_device(batch[4],
                            device=self.device,
                            non_blocking=self.non_blocking)
     return inputs, titles, targets, len_inputs, len_titles
 def parse_batch(
         self,
         batch: List[torch.Tensor]) -> Tuple[torch.Tensor, ...]:
     inputs1 = to_device(batch[0], device=self.device)
     lengths1 = to_device(batch[1], device=self.device)
     inputs2 = to_device(batch[2], device=self.device)
     lengths2 = to_device(batch[3], device=self.device)
     inputs3 = to_device(batch[4], device=self.device)
     lengths3 = to_device(batch[5], device=self.device)
     return inputs1, lengths1, inputs2, lengths2, inputs3, lengths3