class_docstr: Container for replicated `Variables` that are treated as a single variable.
  
  This class maintains a list of replicated variables that are stored on
  separate logic TPU devices. TF2XLA bridge accesses these variables as
  if they were a single variable.
class_docstr_tok: ["Container","for","replicated","`","Variables","`","that","are","treated","as","a","single","variable",".","This","class","maintains","a","list","of","replicated","variables","that","are","stored","on","separate","logic","TPU","devices",".","TF2XLA","bridge","accesses","these","variables","as","if","they","were","a","single","variable","."]
docstr: Treats `variables` as a replicated list of `tf.Variable`s.
  
  Example:
  
  ```
  variables = [
    tf.Variable(..., shape=(10, 100), dtype=tf.float32),
    tf.Variable(..., shape=(10, 100), dtype=tf.float32),
    tf.Variable(..., shape=(10, 100), dtype=tf.float32),
    tf.Variable(..., shape=(10, 100), dtype=tf.float32),
  ]
  replicated_variable = TPUReplicatedVariable(variables)
  assert replicated_variable.shape.as_list() == [10, 100]
  ```
  
  Args:
    variables: A list of `ResourceVariable`s that comprise this replicated
      variable. Variables should not be shared between different
      `TPUReplicatedVariable` objects.
    name: String. Name of this container. Defaults to "TPUReplicatedVariable".
code: def __init__(self, variables, name="TPUReplicatedVariable"):
      """Treats `variables` as a replicated list of `tf.Variable`s.
  
      Example:
  
      ```
      variables = [
        tf.Variable(..., shape=(10, 100), dtype=tf.float32),
        tf.Variable(..., shape=(10, 100), dtype=tf.float32),
        tf.Variable(..., shape=(10, 100), dtype=tf.float32),
        tf.Variable(..., shape=(10, 100), dtype=tf.float32),
      ]
      replicated_variable = TPUReplicatedVariable(variables)
      assert replicated_variable.shape.as_list() == [10, 100]
      ```
  
      Args:
        variables: A list of `ResourceVariable`s that comprise this replicated
          variable. Variables should not be shared between different
          `TPUReplicatedVariable` objects.
        name: String. Name of this container. Defaults to "TPUReplicatedVariable".
      """
      if (
          not isinstance(variables, abc.Sequence)
          or not variables
          or any(
              not isinstance(v, variables_lib.Variable)
              for v in variables
          )
      ):
          raise TypeError(
              "Argument `variables` should be a non-empty list of "
              f"`variables.Variable`s. Received {variables}"
          )
  
      if any(v.dtype != variables[0].dtype for v in variables):
          raise ValueError(
              "All elements in argument `variables` must have the same dtype. "
              f"Received dtypes: {[v.dtype for v in variables]}"
          )
  
      if any(v.shape != variables[0].shape for v in variables):
          raise ValueError(
              "All elements in argument `variables` must have the same shape. "
              f"Received shapes: {[v.shape for v in variables]}"
          )
  
      self._vars = variables
      self._name = name
      self._common_name = self._name.split(":")[0]
      self._cached_value = None
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  from collections import abc
  import contextlib
  from tensorflow.python.compiler.xla.experimental import xla_sharding
  from tensorflow.python.distribute import tpu_util
  from tensorflow.python.eager import context
  from tensorflow.python.framework import config
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import tensor_conversion_registry
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.ops import gen_resource_variable_ops
  from tensorflow.python.ops import gen_tpu_partition_ops
  from tensorflow.python.ops import variable_scope
  from tensorflow.python.ops import variables
  from tensorflow.python.saved_model import save_context
  from tensorflow.python.trackable import base
label_desc: Use image node_id 1 to create a new TPUReplicatedVariable object from inherited base classes: variables_lib with example: obj = TPUReplicatedVariable(variables, name)