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

Function shard_args

imperative/python/megengine/xla/sharding.py:373–384  ·  view source on GitHub ↗
(devices, indices, args, shardings=None)

Source from the content-addressed store, hash-verified

371
372
373def shard_args(devices, indices, args, shardings=None):
374 def _shard_arg(arg, devices, arg_indices, sharding=None):
375 arg = canonicalize_arg(arg)
376 return shard_arg_handlers[type(arg)](arg, devices, arg_indices, sharding)
377
378 if shardings is None:
379 return [_shard_arg(arg, devices, indices[i]) for i, arg in enumerate(args)]
380 else:
381 return [
382 _shard_arg(arg, devices, indices[i], shardings[i])
383 for i, arg in enumerate(args)
384 ]
385
386
387@functools.lru_cache()

Callers

nothing calls this directly

Calls 1

_shard_argFunction · 0.85

Tested by

no test coverage detected