class_docstr: Adds cluster parameters if a `NamedDistribution` has it.
  
  It needs to be before DistributionParameter.
class_docstr_tok: ["Adds","cluster","parameters","if","a","`","NamedDistribution","`","has","it",".","It","needs","to","be","before","DistributionParameter","."]
code: def modified_arguments(self, kwargs, requested_parameters):
      strategy = None
      for _, v in kwargs.items():
          if isinstance(v, NamedDistribution):
              if (
                  strategy is not None
                  and _num_total_workers(v.has_chief, v.num_workers) > 1
              ):
                  raise ValueError(
                      "Only support one NamedDistribution for multi worker"
                      "tests."
                  )
              strategy = v
  
      if strategy:
          has_chief = strategy.has_chief
          num_workers = strategy.num_workers
          runner = strategy.runner
          share_gpu = strategy.share_gpu
          num_ps = strategy.num_ps
          if "has_chief" in kwargs and kwargs["has_chief"] != has_chief:
              raise ValueError(
                  "both has_chief and strategy specified but are not compatible"
              )
          if (
              "num_workers" in kwargs
              and kwargs["num_workers"] != num_workers
          ):
              raise ValueError(
                  "both num_workers and strategy specified but are not compatible"
              )
      else:
          has_chief = kwargs.get("has_chief", False)
          num_workers = kwargs.get("num_workers", 1)
          runner = kwargs.get("runner", None)
          share_gpu = kwargs.get("share_gpu", True)
          num_ps = kwargs.get("num_ps", 0)
  
      # Always set cluster parameters if they're requested. So that generate()
      # works when there's no startegy in the combinations.
      update = {}
      if "has_chief" in requested_parameters:
          update["has_chief"] = has_chief
      if "num_workers" in requested_parameters:
          update["num_workers"] = num_workers
      if "runner" in requested_parameters:
          update["runner"] = runner
      if "share_gpu" in requested_parameters:
          update["share_gpu"] = share_gpu
      if "num_ps" in requested_parameters:
          update["num_ps"] = num_ps
      return update
  
imports: import collections
  import copy
  import re
  import sys
  import types
  import unittest
  from absl import app
  import six
  from tensorflow.python.client import session
  from tensorflow.python.distribute import collective_all_reduce_strategy
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute import multi_process_runner
  from tensorflow.python.distribute import multi_worker_test_base
  from tensorflow.python.eager import context
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import combinations
  from tensorflow.python.framework import config
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_combinations
  from tensorflow.python.framework import test_util
  from tensorflow.python.platform import flags
  from tensorflow.python.platform import tf_logging
  from tensorflow.python.util import tf_decorator
  from tensorflow.python.util import tf_inspect
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 1 for calling the ClusterParameters obj's underlying member method code with example usage: obj.modified_arguments(kwargs, requested_parameters) and returns: update