class_docstr: Helper class for creating sets of parallel function calls.
  
  The purpose of this class is to replace this code:
  
      e = []
      f = []
      for i in range(len(devices)):
        with tf.device(devices[i]):
          e_, f_ = func(a[i], b[i], c)
          e.append(e_)
          f.append(f_)
  
  with this code:
  
      e, f = expert_utils.Parallelism(devices)(func, a, b, c)
class_docstr_tok: ["Helper","class","for","creating","sets","of","parallel","function","calls",".","The","purpose","of","this","class","is","to","replace","this","code",":","e","=","[","]","f","=","[","]","for","i","in","range","(","len","(","devices",")",")",":","with","tf.device","(","devices","[","i","]",")",":","e_",",","f_","=","func","(","a","[","i","]",",","b","[","i","]",",","c",")","e.append","(","e_",")","f.append","(","f_",")","with","this","code",":","e",",","f","=","expert_utils.Parallelism","(","devices",")","(","func",",","a",",","b",",","c",")"]
docstr: Utility function for processing arguments that are singletons or lists.
  
  Args:
    x: either a list of self.n elements, or not a list.
  
  Returns:
    a list of self.n elements.
docstr_tok: ["Utility","function","for","processing","arguments","that","are","singletons","or","lists",".","Args",":","x",":","either","a","list","of","self.n","elements",",","or","not","a","list",".","Returns",":","a","list","of","self.n","elements","."]
code: def _maybe_repeat(self, x):
      """Utility function for processing arguments that are singletons or lists.
  
      Args:
        x: either a list of self.n elements, or not a list.
  
      Returns:
        a list of self.n elements.
      """
      if isinstance(x, list):
          assert len(x) == self.n
          return x
      else:
          return [x] * self.n
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import functools
  import math
  import six
  from six.moves import range
  from six.moves import zip
  from tensor2tensor.layers import common_layers
  from tensor2tensor.layers.vq_discrete import DiscreteBottleneck
  import tensorflow.compat.v1
label_desc: Use image node_id 6 for calling the Parallelism obj's underlying member method code with example usage: obj._maybe_repeat(x) and returns: x, unknown