(batch)
| 143 | |
| 144 | |
| 145 | def pin_memory_batch(batch): |
| 146 | if torch.is_tensor(batch): |
| 147 | return batch.pin_memory() |
| 148 | elif isinstance(batch, string_classes): |
| 149 | return batch |
| 150 | elif isinstance(batch, collections.Mapping): |
| 151 | return {k: pin_memory_batch(sample) for k, sample in batch.items()} |
| 152 | elif isinstance(batch, collections.Sequence): |
| 153 | return [pin_memory_batch(sample) for sample in batch] |
| 154 | else: |
| 155 | return batch |
| 156 | |
| 157 | |
| 158 | _SIGCHLD_handler_set = False |
no outgoing calls
no test coverage detected