MCPcopy Create free account
hub / github.com/pytorch/tutorials / copy_to_device

Function copy_to_device

intermediate_source/pinmem_nonblock.py:346–350  ·  view source on GitHub ↗
(*tensors)

Source from the content-addressed store, hash-verified

344
345# A simple loop that copies all tensors to cuda
346def copy_to_device(*tensors):
347 result = []
348 for tensor in tensors:
349 result.append(tensor.to("cuda:0"))
350 return result
351
352
353# A loop that copies all tensors to cuda asynchronously

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected