class_docstr: Mesh implemented using explicit device placement.
docstr: Execute a function in parallel on all slices.
  
  Args:
    fn: a function from tf.Tensors to tf.Tensor or a tuple of tf.Tensors.
    *inputs: a list of inputs.  Each input is either a LaidOutTensor or
      is convertible to a tf.Tensor.
  Returns:
    a LaidOutTensor, or a tuple of LaidOutTensors if fn returns a tuple.
docstr_tok: ["Execute","a","function","in","parallel","on","all","slices",".","Args",":","fn",":","a","function","from","tf.Tensors","to","tf.Tensor","or","a","tuple","of","tf.Tensors",".","*","inputs",":","a","list","of","inputs",".","Each","input","is","either","a","LaidOutTensor","or","is","convertible","to","a","tf.Tensor",".","Returns",":","a","LaidOutTensor",",","or","a","tuple","of","LaidOutTensors","if","fn","returns","a","tuple","."]
code: def slicewise(self, fn, *inputs):
      """Execute a function in parallel on all slices.
  
      Args:
        fn: a function from tf.Tensors to tf.Tensor or a tuple of tf.Tensors.
        *inputs: a list of inputs.  Each input is either a LaidOutTensor or
          is convertible to a tf.Tensor.
      Returns:
        a LaidOutTensor, or a tuple of LaidOutTensors if fn returns a tuple.
      """
      # convert all inputs to LaidOutTensor where possible
      inputs = mtf.convert_args_to_laid_out_tensors(inputs)
      inputs = [
          x.tensor_list
          if isinstance(x, self.LaidOutTensor)
          else [x] * len(self.devices)
          for x in inputs
      ]
      ret = mtf.parallel(self.devices, fn, *inputs)
      if isinstance(ret[0], tuple):
          ret = mtf.transpose_list_of_lists(ret)
          return tuple([self.LaidOutTensor(t) for t in ret])
      else:
          return self.LaidOutTensor(ret)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import os
  import random
  from mesh_tensorflow import ops_with_redefined_builtins
  from six.moves import xrange
  import tensorflow.compat.v1
label_desc: Use image node_id 2 for calling the PlacementMeshImpl obj's underlying member method code with example usage: obj.slicewise(fn) and returns: tuple, self