class_docstr: Extended class for ParameterServerStrategyV2.
  
  Please see `tf.distribute.StrategyExtended` doc for more information.
class_docstr_tok: ["Extended","class","for","ParameterServerStrategyV2",".","Please","see","`","tf.distribute.StrategyExtended","`","doc","for","more","information","."]
docstr: Initialization of ParameterServerStrategyV2Extended.
docstr_tok: ["Initialization","of","ParameterServerStrategyV2Extended","."]
code: def __init__(
      self,
      container_strategy,
      cluster_resolver: base_cluster_resolver.ClusterResolver,
      variable_partitioner,
  ):
      """Initialization of ParameterServerStrategyV2Extended."""
      super(ParameterServerStrategyV2Extended, self).__init__(
          container_strategy
      )
      self._num_ps = len(
          cluster_resolver.cluster_spec().as_dict().get("ps", [])
      )
      self._num_workers = len(
          cluster_resolver.cluster_spec().as_dict().get("worker", [])
      )
      self._variable_count = 0
  
      self._variable_partitioner = variable_partitioner
      # The following two attrs are to verify that `ParameterServerStrategy`
      # methods are properly used with a `ClusterCoordinator`.
      self._used_with_coordinator = False
      self._being_scheduled = False
      self._set_num_gpus()
      distribute_lib.distribution_strategy_replica_gauge.get_cell(
          "num_gpus_per_worker"
      ).set(self._num_gpus_per_worker)
  
      # Don't canonicalize the devices here since this code is executed on Chief,
      # but we want the reduce evaluation to be done on each worker. Placer will
      # automatically choose the right device based on current context.
      # TODO(ishark): Use select_cross_device_ops instead.
      self._cross_device_ops = (
          cross_device_ops_lib.ReductionToOneDevice(
              reduce_to_device="/device:CPU:0"
          )
      )
      self._cross_device_ops._canonicalize_devices = (
          False  # pylint: disable=protected-access
      )
      self._allow_run_without_coordinator = False
      self._coordinator_creation_lock = threading.Lock()
  
imports: import functools
  import os
  import threading
  from tensorflow.python.distribute import cross_device_ops
  from tensorflow.python.distribute import device_util
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute import input_lib
  from tensorflow.python.distribute import input_util
  from tensorflow.python.distribute import load_context
  from tensorflow.python.distribute import mirrored_run
  from tensorflow.python.distribute import multi_worker_util
  from tensorflow.python.distribute import parameter_server_strategy
  from tensorflow.python.distribute import ps_values
  from tensorflow.python.distribute import sharded_variable
  from tensorflow.python.distribute import values
  from tensorflow.python.distribute.cluster_resolver import cluster_resolver
  from tensorflow.python.distribute.coordinator import cluster_coordinator
  from tensorflow.python.eager import context
  from tensorflow.python.eager import remote
  from tensorflow.python.framework import config
  from tensorflow.python.framework import device
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_shape
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import resource_variable_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.trackable import base
  from tensorflow.python.training import server_lib
  from tensorflow.python.util import nest
  from tensorflow.python.util import tf_inspect
  from tensorflow.python.util.tf_export import tf_export
  from tsl.protobuf import coordination_config_pb2
label_desc: Use image node_id 1 to create a new ParameterServerStrategyV2Extended object from inherited base classes: parameter_server_strategy with example: obj = ParameterServerStrategyV2Extended(container_strategy, cluster_resolver, variable_partitioner)