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

Function _shard_nparray

imperative/python/megengine/xla/sharding.py:323–326  ·  view source on GitHub ↗
(x, devices, indices, sharding=None)

Source from the content-addressed store, hash-verified

321
322
323def _shard_nparray(x, devices, indices, sharding=None):
324 if x.shape == ():
325 return device_put([x] * len(devices), devices)
326 return device_put([x[i] for i in indices], devices)
327
328
329def _shard_xla_device_array(x: xc._xla.DeviceArray, devices, indices, sharding=None):

Callers

nothing calls this directly

Calls 1

device_putFunction · 0.85

Tested by

no test coverage detected