class_docstr: Creates mtf graph, mesh, and mesh implementation.
class_docstr_tok: ["Creates","mtf","graph",",","mesh",",","and","mesh","implementation","."]
docstr: Creates mtf graph, mesh, and mesh impl.
  
  This function can be called inside model_fn, which might be tpu_rewritten.
  
  Returns:
    graph, mesh, mesh_impl
docstr_tok: ["Creates","mtf","graph",",","mesh",",","and","mesh","impl",".","This","function","can","be","called","inside","model_fn",",","which","might","be","tpu_rewritten",".","Returns",":","graph",",","mesh",",","mesh_impl"]
code: def create_graph_mesh_and_mesh_impl(self):
      """Creates mtf graph, mesh, and mesh impl.
  
      This function can be called inside model_fn, which might be tpu_rewritten.
  
      Returns:
        graph, mesh, mesh_impl
      """
  
      if self._use_tpu:
          assert self._d_assignment
          graph = mtf.Graph()
  
          # Worker 0 caches all the TPU binaries.
          replica_cache_size = 300 * 1024 * 1024  # 300M per replica.
          worker0_mem = replica_cache_size * 8 * self._num_hosts
          devices_memory_usage = [worker0_mem] + [0] * (
              self._num_hosts - 1
          )
          var_placer = mtf.utils.BalancedVariablePlacer(
              self._cpu_devices, devices_memory_usage
          )
          mesh = mtf.Mesh(graph, "my_mesh", var_placer)
          mesh_impl = mtf.simd_mesh_impl.SimdMeshImpl(
              self._mesh_shape,
              self._layout_rules,
              None,
              self._d_assignment,
          )
          return graph, mesh, mesh_impl
  
      else:
          graph = mtf.Graph()
          mesh = mtf.Mesh(graph, "my_mesh", None)
          mesh_impl = mtf.placement_mesh_impl.PlacementMeshImpl(
              self._mesh_shape, self._layout_rules, self._gpu_devices
          )
          return graph, mesh, mesh_impl
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import re
  import mesh_tensorflow
  import numpy
  import six
  from six.moves import range
  from six.moves import zip
  import tensorflow.compat.v1
  from tensorflow.compat.v1 import estimator
  from mesh_tensorflow.experimental import input_reader
  from mesh_tensorflow.experimental import unet
  from tensorflow.contrib import summary
  from tensorflow.contrib import tpu
  from tensorflow.contrib.tpu.python.tpu import device_assignment
  from tensorflow.python.framework import ops
  from tensorflow.python.ops import control_flow_ops
  from tensorflow.python.platform import flags
  from tensorflow.python.tpu.ops import tpu_ops
label_desc: Use image node_id 2 for calling the MeshContext obj's underlying member method code with example usage: obj.create_graph_mesh_and_mesh_impl() and returns: graph,  mesh,  mesh_impl, graph,  mesh,  mesh_impl