class_docstr: Mesh implementation for TPU using SIMD and MPI operations.
class_docstr_tok: ["Mesh","implementation","for","TPU","using","SIMD","and","MPI","operations","."]
docstr: "Slice out the corresponding part of tensor given the pnum variable.
code: def slice(self, tf_tensor, tensor_shape):
      """ "Slice out the corresponding part of tensor given the pnum variable."""
      tensor_layout = self.tensor_layout(tensor_shape)
  
      if tensor_layout.is_fully_replicated:
          return self.LaidOutTensor([tf_tensor])
      else:
          slice_shape = self.slice_shape(tensor_shape)
          slice_begins = [
              self.slice_begin(tensor_shape, pnum)
              for pnum in xrange(self.size)
          ]
          slice_begins_tensor = tf.stack(slice_begins)
          # slice on source device
          selected_slice_begin = tf.gather(
              slice_begins_tensor, self.pnum_tensor
          )
          return self.LaidOutTensor(
              [tf.slice(tf_tensor, selected_slice_begin, slice_shape)]
          )
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import math
  import os
  import gin
  from mesh_tensorflow import ops_with_redefined_builtins
  from mesh_tensorflow import tpu_variables
  from mesh_tensorflow import utils
  from six.moves import xrange
  import tensorflow.compat.v1
  from tensorflow.python.tpu.ops import tpu_ops
label_desc: Use image node_id 11 for calling the SimdMeshImpl obj's underlying member method code with example usage: obj.slice(tf_tensor, tensor_shape) and returns: self, self