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

Function device_put

imperative/python/megengine/xla/device.py:64–74  ·  view source on GitHub ↗
(x, devices: Sequence[xb.xla_client.Device], replicate: bool = False)

Source from the content-addressed store, hash-verified

62
63
64def device_put(x, devices: Sequence[xb.xla_client.Device], replicate: bool = False):
65 if replicate:
66 return list(
67 it.chain.from_iterable(_device_put_impl(x, device) for device in devices)
68 )
69 else:
70 return list(
71 it.chain.from_iterable(
72 _device_put_impl(val, device) for val, device in safe_zip(x, devices)
73 )
74 )
75
76
77def get_xla_backend_and_device(device=None) -> Tuple[Backend, Sequence[xc.Device]]:

Callers 3

_shard_nparrayFunction · 0.85
_shard_xla_device_arrayFunction · 0.85
_shard_mge_tensorFunction · 0.85

Calls 3

listFunction · 0.85
_device_put_implFunction · 0.85
safe_zipFunction · 0.85

Tested by

no test coverage detected