def _collate(self, batch):
        """
        Puts each data field into a tensor.

        :param batch: The input data batch.
        :type batch: list of features
        :return: Preprocessed data.
        :rtype: torch.Tensor or pair of torch.Tensor
        """

        if isinstance(batch[0], tuple):
            return [self._cuda(torch.Tensor(samples)) for samples in list(zip(*batch))]
        else:
            return self._cuda(torch.Tensor(batch))
def _collate ( self , batch ) : if isinstance ( batch [ 0 ] , tuple ) : return [ self . _cuda ( torch . Tensor ( samples ) ) for samples in list ( zip ( * batch ) ) ] else : return self . _cuda ( torch . Tensor ( batch ) )
Puts each data field into a tensor.

        :param batch: The input data batch.
        :type batch: list of features
        :return: Preprocessed data.
        :rtype: torch.Tensor or pair of torch.Tensor