def __setstate__(self, state):
    self._sharded_tensor_id = None
    if (not distributed_c10d.is_initialized()):
        raise RuntimeError('Need to initialize default process group using "init_process_group" before loading ShardedTensor')
    (self._local_shards, self._metadata, pg_state, self._sharding_spec, self._init_rrefs) = state
    self._process_group = get_current_process_group()
    local_rank = distributed_c10d.get_rank(self._process_group)
    if (pg_state.local_rank != local_rank):
        raise RuntimeError(f'Local rank at save time was {pg_state.local_rank}, but at load time was {local_rank}')
    global_rank = distributed_c10d.get_rank()
    if (pg_state.global_rank != global_rank):
        raise RuntimeError(f'Global rank at save time was {pg_state.global_rank}, but at load time was {global_rank}')
    local_world_size = distributed_c10d.get_world_size(self._process_group)
    if (pg_state.local_world_size != local_world_size):
        raise RuntimeError(f'Local world size at save time was {pg_state.local_world_size}, but at load time was {local_world_size}')
    global_world_size = distributed_c10d.get_world_size()
    if (pg_state.global_world_size != global_world_size):
        raise RuntimeError(f'Global world size at save time was {pg_state.global_world_size}, but at load time was {global_world_size}')
    self._post_init()
def __setstate__(self, state):
    self._sharded_tensor_id = None
    if (not distributed_c10d.is_initialized()):
        raise RuntimeError('Need to initialize default process group using "init_process_group" before loading ShardedTensor')
    (self._local_shards, self._metadata, pg_state, self._sharding_spec, self._init_rrefs) = state
    self._process_group = get_current_process_group()
    local_rank = distributed_c10d.get_rank(self._process_group)
    if (pg_state.local_rank != local_rank):
        raise RuntimeError(f'Local rank at save time was {pg_state.local_rank}, but at load time was {local_rank}')
    global_rank = distributed_c10d.get_rank()
    if (pg_state.global_rank != global_rank):
        raise RuntimeError(f'Global rank at save time was {pg_state.global_rank}, but at load time was {global_rank}')
    local_world_size = distributed_c10d.get_world_size(self._process_group)
    if (pg_state.local_world_size != local_world_size):
        raise RuntimeError(f'Local world size at save time was {pg_state.local_world_size}, but at load time was {local_world_size}')
    global_world_size = distributed_c10d.get_world_size()
    if (pg_state.global_world_size != global_world_size):
        raise RuntimeError(f'Global world size at save time was {pg_state.global_world_size}, but at load time was {global_world_size}')
    self._post_init()