'Create a DistributedSparseDispatcher.
Args:
datashard_devices: a list of num_datashards device strings.
expert_devices: a list of num_experts device strings.
gates: a list of num_datashards `Tensor`s of shapes
`[batch_size[d], num_experts]`.
Returns:
a DistributedSparseDispatcher'

def __init__(self, datashard_devices, expert_devices, gates):

    self._gates = gates
    self._num_experts = len(expert_devices)
    assert (len(gates) == len(datashard_devices))
    self._num_datashards = len(gates)
    self._datashard_devices = datashard_devices
    self._expert_devices = expert_devices
    self._dispatchers = Parallel(self._datashard_devices, SparseDispatcher, self._num_experts, gates)
