class_docstr: tf.Graph & mtf.Graph common representation which produces a CostGraphDef.
  
  Attributes:
    canonical_device: string or None, the name of the canonical device for
        is_tensor_on_canonical_device
  
  Usage Example:
    mtf_graph = mtf.Graph()
    # Add operations to mtf_graph using Mesh TensorFlow.
    graph = graph_interface.GraphInterface(mtf_graph)
    for operation_name in graph.get_all_operation_names():
      print("Operation: {}".format(operation_name))
      for input_name in graph.get_operation_input_names(operation_name):
        print("  Input: {}".format(input_name))
      for output_name in graph.get_operation_output_names(operation_name):
        print("  Output: {}".format(output_name))
        # Tensor names can also be used to retrieve data type, shape, and Mesh
        # TensorFlow dimension names.
      # Operation names can also be used to get Mesh TensorFlow dimension names.
    cost_graph = graph.compute_cost_graph()
    # Give cost_graph to a scheduler to compute schedule.
    memory_contents = graph.compute_memory_contents_under_schedule(schedule)
class_docstr_tok: ["tf.Graph","&","mtf.Graph","common","representation","which","produces","a","CostGraphDef",".","Attributes",":","canonical_device",":","string","or","None",",","the","name","of","the","canonical","device","for","is_tensor_on_canonical_device","Usage","Example",":","mtf_graph","=","mtf.Graph","(",")","#","Add","operations","to","mtf_graph","using","Mesh","TensorFlow",".","graph","=","graph_interface.GraphInterface","(","mtf_graph",")","for","operation_name","in","graph.get_all_operation_names","(",")",":","print","(","``","Operation",":","{","}","''",".format","(","operation_name",")",")","for","input_name","in","graph.get_operation_input_names","(","operation_name",")",":","print","(","``","Input",":","{","}","''",".format","(","input_name",")",")","for","output_name","in","graph.get_operation_output_names","(","operation_name",")",":","print","(","``","Output",":","{","}","''",".format","(","output_name",")",")","#","Tensor","names","can","also","be","used","to","retrieve","data","type",",","shape",",","and","Mesh","#","TensorFlow","dimension","names",".","#","Operation","names","can","also","be","used","to","get","Mesh","TensorFlow","dimension","names",".","cost_graph","=","graph.compute_cost_graph","(",")","#","Give","cost_graph","to","a","scheduler","to","compute","schedule",".","memory_contents","=","graph.compute_memory_contents_under_schedule","(","schedule",")"]
docstr: The number of entries in a tensor.
  
  If partial_layout is specified, then mesh_dimension_to_size must also be. In
  this case, the number of entries on a single device is returned.
  
  Args:
    tensor_name: a string, name of a tensor in the graph.
    partial_layout: an optional {string: string}, from MTF dimension name to
        mesh dimension name.
    mesh_dimension_to_size: an optional {string: int}, from mesh dimension
        name to size.
  
  Returns:
    an integer
docstr_tok: ["The","number","of","entries","in","a","tensor",".","If","partial_layout","is","specified",",","then","mesh_dimension_to_size","must","also","be",".","In","this","case",",","the","number","of","entries","on","a","single","device","is","returned",".","Args",":","tensor_name",":","a","string",",","name","of","a","tensor","in","the","graph",".","partial_layout",":","an","optional","{","string",":","string","}",",","from","MTF","dimension","name","to","mesh","dimension","name",".","mesh_dimension_to_size",":","an","optional","{","string",":","int","}",",","from","mesh","dimension","name","to","size",".","Returns",":","an","integer"]
code: def get_tensor_num_entries(
      self,
      tensor_name,
      partial_layout=None,
      mesh_dimension_to_size=None,
  ):
      """The number of entries in a tensor.
  
      If partial_layout is specified, then mesh_dimension_to_size must also be. In
      this case, the number of entries on a single device is returned.
  
      Args:
        tensor_name: a string, name of a tensor in the graph.
        partial_layout: an optional {string: string}, from MTF dimension name to
            mesh dimension name.
        mesh_dimension_to_size: an optional {string: int}, from mesh dimension
            name to size.
  
      Returns:
        an integer
      """
      shape = self.get_tensor_shape(tensor_name)
      # We don't have to worry about divisiblity issues because Mesh TensorFlow
      # only allows evenly divisible assignments.
      num_entries = 1
      for dim in shape.dims:
          num_entries = num_entries * dim.value
  
      if not partial_layout:
          return num_entries
  
      for mtf_dimension_name in self.get_tensor_mtf_dimension_names(
          tensor_name
      ):
          if mtf_dimension_name not in partial_layout:
              continue
          mesh_dimension_name = partial_layout[mtf_dimension_name]
          mesh_dimension_size = mesh_dimension_to_size[
              mesh_dimension_name
          ]
          num_entries = int(
              math.ceil(num_entries / mesh_dimension_size)
          )
  
      return num_entries
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import math
  import mesh_tensorflow
  import tensorflow.compat.v1
  from tensorflow.core.framework import cost_graph_pb2
label_desc: Use image node_id 9 for calling the GraphInterface obj's underlying member method code with example usage: obj.get_tensor_num_entries(tensor_name, partial_layout, mesh_dimension_to_size) and returns: num_entries, num_entries