class_docstr: Synchronous training across multiple replicas on one machine.
  
  This strategy is typically used for training on one machine with multiple
  accelerators (GPUs/TPUs).
  
  For example, a variable created under a `MirroredStrategy` is a distributed
  variable with layout replicated on each dimension. The variables will be
  placed on the `mesh` that is specified in the __init__.
class_docstr_tok: ["Synchronous","training","across","multiple","replicas","on","one","machine",".","This","strategy","is","typically","used","for","training","on","one","machine","with","multiple","accelerators","(","GPUs\/TPUs",")",".","For","example",",","a","variable","created","under","a","`","MirroredStrategy","`","is","a","distributed","variable","with","layout","replicated","on","each","dimension",".","The","variables","will","be","placed","on","the","`","mesh","`","that","is","specified","in","the","__init__","."]
docstr: Synchronous training across multiple replicas on one machine.
  
  Args:
    devices: a list of device strings, such as ['/gpu:0', '/gpu:1']. If both
      `mesh` and `devices` are None, all the available GPU/TPU will be used.
      If no accelerators are found, CPU is used.
    cross_device_ops: optional, a descendant of `CrossDeviceOps`. The value is
      ignored at the moment, and support will be added later.
    mesh: optional DTensor mesh for the computation. Note that either `mesh`
      or `devices` should be provided, and not both. The mesh should be 1D,
      and will be used to split the input data among that dimension.
docstr_tok: ["Synchronous","training","across","multiple","replicas","on","one","machine",".","Args",":","devices",":","a","list","of","device","strings",",","such","as","[","'\/gpu:0","'",",","'\/gpu:1","'","]",".","If","both","`","mesh","`","and","`","devices","`","are","None",",","all","the","available","GPU\/TPU","will","be","used",".","If","no","accelerators","are","found",",","CPU","is","used",".","cross_device_ops",":","optional",",","a","descendant","of","`","CrossDeviceOps","`",".","The","value","is","ignored","at","the","moment",",","and","support","will","be","added","later",".","mesh",":","optional","DTensor","mesh","for","the","computation",".","Note","that","either","`","mesh","`","or","`","devices","`","should","be","provided",",","and","not","both",".","The","mesh","should","be","1D",",","and","will","be","used","to","split","the","input","data","among","that","dimension","."]
code: def __init__(self, devices=None, cross_device_ops=None, *, mesh=None):
      """Synchronous training across multiple replicas on one machine.
  
      Args:
        devices: a list of device strings, such as ['/gpu:0', '/gpu:1']. If both
          `mesh` and `devices` are None, all the available GPU/TPU will be used.
          If no accelerators are found, CPU is used.
        cross_device_ops: optional, a descendant of `CrossDeviceOps`. The value is
          ignored at the moment, and support will be added later.
        mesh: optional DTensor mesh for the computation. Note that either `mesh`
          or `devices` should be provided, and not both. The mesh should be 1D,
          and will be used to split the input data among that dimension.
      """
      self._validate_init_args(mesh, devices)
      if not mesh:
          mesh = self._build_mesh_from_device_list(devices)
  
      extended = dtensor_strategy_extended.DTensorStrategyExtended(
          container_strategy=self, mesh=mesh
      )
      super().__init__(extended)
      self._mesh = mesh
      self._devices = devices
  
file_path: tensorflow-upstream/tensorflow/python/distribute/experimental/mirrored_strategy.py
imports: from tensorflow.dtensor.python import config
  from tensorflow.dtensor.python import mesh_util
  from tensorflow.python.distribute import distribute_lib
  from tensorflow.python.distribute.experimental import dtensor_strategy_extended
  from tensorflow.python.distribute.experimental import dtensor_util
  from tensorflow.python.framework import device
label_desc: Use image node_id 1 to create a new MirroredStrategy object from inherited base classes: distribute_lib with example: obj = MirroredStrategy(devices, cross_device_ops)