ZeRO assigns each device a slice of the flattened parameters. Each device needs to know exactly which elements it owns, which is the start and end of its contiguous range.
Implement partition_bounds(total, N, rank), returning the half-open range of elements for one device.
Compute the sizes of all shards with the array-split rule, sum the sizes before this rank for its start, then add its size.
No results yet
Run your code to check it against the examples, or submit to run every test.