MCPcopy Create free account
hub / github.com/FreeformRobotics/OTS / pin_memory_batch

Function pin_memory_batch

lib/utils/data/dataloader.py:145–155  ·  view source on GitHub ↗
(batch)

Source from the content-addressed store, hash-verified

143
144
145def 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

Callers 2

_worker_manager_loopFunction · 0.85
__next__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected