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: Whether this MTF dimension may be assigned to this mesh dimension.
  
  Args:
    mtf_dimension_name: string, the name of a Mesh TensorFlow dimension.
    mesh_dimension_name: string, the name of a mesh dimension.
  
  Returns:
    A boolean indicating whether the assignment is valid.
docstr_tok: ["Whether","this","MTF","dimension","may","be","assigned","to","this","mesh","dimension",".","Args",":","mtf_dimension_name",":","string",",","the","name","of","a","Mesh","TensorFlow","dimension",".","mesh_dimension_name",":","string",",","the","name","of","a","mesh","dimension",".","Returns",":","A","boolean","indicating","whether","the","assignment","is","valid","."]
code: def is_valid_assignment(
      self, mtf_dimension_name, mesh_dimension_name
  ):
      """Whether this MTF dimension may be assigned to this mesh dimension.
  
      Args:
        mtf_dimension_name: string, the name of a Mesh TensorFlow dimension.
        mesh_dimension_name: string, the name of a mesh dimension.
  
      Returns:
        A boolean indicating whether the assignment is valid.
      """
      return (
          mtf_dimension_name in self._splittable_mtf_dimension_names
      ) and (
          self._mtf_dimension_name_to_size_gcd[mtf_dimension_name]
          % self._mesh_dimension_name_to_size[mesh_dimension_name]
          == 0
      )
  
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 4 for calling the LayoutValidator obj's underlying member method code with example usage: obj.is_valid_assignment(mtf_dimension_name, mesh_dimension_name) and returns: unknown