MCPcopy Create free account
hub / github.com/ModelTC/LightX2V / set_device

Method set_device

tools/preprocess/pose2d.py:43–52  ·  view source on GitHub ↗
(self, device)

Source from the content-addressed store, hash-verified

41 return output_names
42
43 def set_device(self, device):
44 if isinstance(device, str):
45 device = torch.device(device)
46 if device.type == "cuda":
47 device = "{}:{}".format(device.type, device.index)
48 providers = [("CUDAExecutionProvider", {"device_id": device[-1:] if device[-1] in [str(_i) for _i in range(10)] else "0"}), "CPUExecutionProvider"]
49 else:
50 providers = ["CPUExecutionProvider"]
51 self.session.set_providers(providers)
52 self.device = device
53
54
55class Yolo(SimpleOnnxInference):

Callers 15

init_parallel_envMethod · 0.80
init_parallel_envMethod · 0.80
init_parallel_envMethod · 0.80
init_parallel_envMethod · 0.80
init_parallel_envMethod · 0.80
init_parallel_envMethod · 0.80
init_parallel_envMethod · 0.80
init_parallel_envMethod · 0.80
init_parallel_envMethod · 0.80
_init_parallelMethod · 0.80
va_reader_omni.pyFile · 0.80
va_reader.pyFile · 0.80

Calls 1

deviceMethod · 0.45

Tested by 1

setUpMethod · 0.64