class_docstr: Validates potential Mesh TensorFlow layouts.
  
  Usage Example:
    mtf_graph = mtf.Graph()
    # Add operations to mtf_graph using Mesh TensorFlow.
    mesh_shape = mtf.Shape([("m1", 4), ("m2", 2)])
    layout_validator = valid_layouts.LayoutValidator(mtf_graph, mesh_shape)
  
    print(layout_validator.splittable_mtf_dimension_names)
    # Set of names of Mesh TensorFlow dimensions that may be assigned to mesh
    # dimensions.
  
    print(layout_validator.is_valid_assignment("batch", "m1"))
    # Whether the 'batch' Mesh TensorFlow dimension may be assigned to the 'm1'
    # mesh dimension. Unlike the previous method, this ensures that every
    # occurrence of the 'batch' dimension has a size that is evenly divisible by
    # the size of 'm1'.
  
  Attributes:
    splittable_mtf_dimension_names: a set(string) of the names of MTF dimensions
        that may be assigned in a layout.
    mesh_dimension_name_to_size: a {string: int}, mapping names of mesh
        dimensions to their size.
docstr: Initializer for self._splittable_mtf_dimension_names.
  
  Args:
    mtf_graph: an mtf.Graph.
  
  Returns:
    A set(string) of the names of Mesh TensorFlow dimensions that may be
    assigned in a layout.
docstr_tok: ["Initializer","for","self._splittable_mtf_dimension_names",".","Args",":","mtf_graph",":","an","mtf.Graph",".","Returns",":","A","set","(","string",")","of","the","names","of","Mesh","TensorFlow","dimensions","that","may","be","assigned","in","a","layout","."]
code: def _initialize_splittable_dimensions(self, mtf_graph):
      """Initializer for self._splittable_mtf_dimension_names.
  
      Args:
        mtf_graph: an mtf.Graph.
  
      Returns:
        A set(string) of the names of Mesh TensorFlow dimensions that may be
        assigned in a layout.
      """
      all_mtf_dimension_names = set()  # set(string)
      for mtf_operation in mtf_graph.operations:
          for mtf_tensor in mtf_operation.outputs:
              for mtf_dimension in mtf_tensor.shape.dims:
                  if not re.match(
                      r"_anonymous_\d*", mtf_dimension.name
                  ):
                      all_mtf_dimension_names.add(mtf_dimension.name)
  
      unsplittable_mtf_dimension_names = set()  # set(string)
      for mtf_operation in mtf_graph.operations:
          unsplittable_mtf_dimension_names.update(
              mtf_operation.unsplittable_dims
          )
  
      return all_mtf_dimension_names - unsplittable_mtf_dimension_names
  
file_path: mesh/mesh_tensorflow/auto_mtf/valid_layouts.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import re
label_desc: Use image node_id 5 for calling the LayoutValidator obj's underlying member method code with example usage: obj._initialize_splittable_dimensions(mtf_graph) and returns: unknown