class_docstr: Represent a collection of device filters for the remote workers in cluster.
  
  NOTE: this is an experimental API and subject to changes.
  
  Set device filters for selective jobs and tasks. For each remote worker, the
  device filters are a list of strings. When any filters are present, the remote
  worker will ignore all devices which do not match any of its filters. Each
  filter can be partially specified, e.g. "/job:ps", "/job:worker/replica:3",
  etc. Note that a device is always visible to the worker it is located on.
  
  For example, to set the device filters for a parameter server cluster:
  
  ```python
  cdf = tf.config.experimental.ClusterDeviceFilters()
  for i in range(num_workers):
    cdf.set_device_filters('worker', i, ['/job:ps'])
  for i in range(num_ps):
    cdf.set_device_filters('ps', i, ['/job:worker'])
  
  tf.config.experimental_connect_to_cluster(cluster_def,
                                            cluster_device_filters=cdf)
  ```
  
  The device filters can be partically specified. For remote tasks that do not
  have device filters specified, all devices will be visible to them.
class_docstr_tok: ["Represent","a","collection","of","device","filters","for","the","remote","workers","in","cluster",".","NOTE",":","this","is","an","experimental","API","and","subject","to","changes",".","Set","device","filters","for","selective","jobs","and","tasks",".","For","each","remote","worker",",","the","device","filters","are","a","list","of","strings",".","When","any","filters","are","present",",","the","remote","worker","will","ignore","all","devices","which","do","not","match","any","of","its","filters",".","Each","filter","can","be","partially","specified",",","e.g",".","``","\/job",":","ps","''",",","``","\/job",":","worker\/replica:3","''",",","etc",".","Note","that","a","device","is","always","visible","to","the","worker","it","is","located","on",".","For","example",",","to","set","the","device","filters","for","a","parameter","server","cluster",":","``","`","python","cdf","=","tf.config.experimental.ClusterDeviceFilters","(",")","for","i","in","range","(","num_workers",")",":","cdf.set_device_filters","(","'worker","'",",","i",",","[","'\/job",":","ps","'","]",")","for","i","in","range","(","num_ps",")",":","cdf.set_device_filters","(","'ps","'",",","i",",","[","'\/job",":","worker","'","]",")","tf.config.experimental_connect_to_cluster","(","cluster_def",",","cluster_device_filters=cdf",")","``","`","The","device","filters","can","be","partically","specified",".","For","remote","tasks","that","do","not","have","device","filters","specified",",","all","devices","will","be","visible","to","them","."]
docstr: Set the device filters for given job name and task id.
docstr_tok: ["Set","the","device","filters","for","given","job","name","and","task","id","."]
code: def set_device_filters(self, job_name, task_index, device_filters):
      """Set the device filters for given job name and task id."""
      assert all(isinstance(df, str) for df in device_filters)
      self._device_filters.setdefault(job_name, {})
      self._device_filters[job_name][task_index] = [
          df for df in device_filters
      ]
      # Due to updates in data, invalidate the serialized proto cache.
      self._cluster_device_filters = None
  
imports: from tensorflow.core.protobuf import cluster_pb2
  from tensorflow.core.protobuf import device_filters_pb2
  from tensorflow.core.protobuf import tensorflow_server_pb2
  from tensorflow.python.client import pywrap_tf_session
  from tensorflow.python.framework import errors
  from tensorflow.python.util import compat
  from tensorflow.python.util import deprecation
  from tensorflow.python.util.tf_export import tf_export
label_desc: Use image node_id 2 for calling the ClusterDeviceFilters obj's underlying member method code with example usage: obj.set_device_filters(job_name, task_index, device_filters) without return types