MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / _valid_device

Function _valid_device

imperative/python/megengine/device.py:59–64  ·  view source on GitHub ↗
(inp)

Source from the content-addressed store, hash-verified

57
58
59def _valid_device(inp):
60 if isinstance(inp, str) and re.match(
61 "^([cxg]pu|rocm|multithread|cambricon)(x|\d+)(:\d+)?$", inp
62 ):
63 return True
64 return False
65
66
67def _str2device_type(type_str: str, allow_unspec: bool = True):

Callers 3

set_default_deviceFunction · 0.85
toMethod · 0.85

Calls 1

matchMethod · 0.45

Tested by

no test coverage detected