def _sharded_call(f: lu.WrappedFun, vals: Sequence[TfVal], in_parts: Sequence[pxla.PartitionsOrReplicated], out_parts_thunk, **_) -> Sequence[Tuple[(TfVal, core.AbstractValue)]]:
    sharded_vals = util.safe_map(split_to_logical_devices, vals, in_parts)
    vals_out = f.call_wrapped(*sharded_vals)
    out_parts_flat = out_parts_thunk()
    assert (len(out_parts_flat) == len(vals_out)), f'expected {len(out_parts_flat)} == {len(vals_out)}'
    sharded_vals_out = [(split_to_logical_devices(val, val_part), val_aval) for ((val, val_aval), val_part) in util.safe_zip(vals_out, out_parts_flat)]
    return sharded_vals_out
def _sharded_call(f: lu.WrappedFun, vals: Sequence[TfVal], in_parts: Sequence[pxla.PartitionsOrReplicated], out_parts_thunk, **_) -> Sequence[Tuple[(TfVal, core.AbstractValue)]]:
    sharded_vals = util.safe_map(split_to_logical_devices, vals, in_parts)
    vals_out = f.call_wrapped(*sharded_vals)
    out_parts_flat = out_parts_thunk()
    assert (len(out_parts_flat) == len(vals_out)), f'expected {len(out_parts_flat)} == {len(vals_out)}'
    sharded_vals_out = [(split_to_logical_devices(val, val_part), val_aval) for ((val, val_aval), val_part) in util.safe_zip(vals_out, out_parts_flat)]
    return sharded_vals_out