code: def _testRandom(self, dtype):
      # Random dims of rank 5
      shape = np.random.randint(1, 5, size=5)
      # Random number of tensors, but always > 1.
      num_tensors = np.random.randint(2, 10)
      # Random dim to concat on
      concat_dim = np.random.randint(5)
      params = {}
      if dtype == dtypes.bfloat16:
          dtype_feed = dtypes.float32
      else:
          dtype_feed = dtype
      with self.session():
          p = []
          for i in np.arange(num_tensors):
              input_shape = shape
              input_shape[concat_dim] = np.random.randint(1, 5)
              placeholder = array_ops.placeholder(
                  dtype_feed, shape=input_shape
              )
              p.append(placeholder)
  
              t = dtype_feed.as_numpy_dtype
              params[placeholder] = np.random.rand(*input_shape).astype(
                  t
              )
  
          if dtype != dtype_feed:
              concat_inputs = [math_ops.cast(p_i, dtype) for p_i in p]
          else:
              concat_inputs = p
          c = array_ops.concat(concat_inputs, concat_dim)
          if dtype != dtype_feed:
              c = math_ops.cast(c, dtype_feed)
          result = c.eval(feed_dict=params)
  
      self.assertEqual(result.shape, c.get_shape())
      cur_offset = 0
  
      for i in np.arange(num_tensors):
          # The index into the result is the ':' along all dimensions
          # except the concat_dim. slice(0, size) is used for ':', and
          # a list of slices is used to index into result.
          ind = [slice(0, params[p[i]].shape[j]) for j in np.arange(5)]
          ind[concat_dim] = slice(
              cur_offset, cur_offset + params[p[i]].shape[concat_dim]
          )
          cur_offset += params[p[i]].shape[concat_dim]
          if dtype == dtype_feed:
              self.assertAllEqual(result[tuple(ind)], params[p[i]])
          else:
              self.assertAllClose(
                  result[tuple(ind)], params[p[i]], 0.01
              )
  
imports: import numpy
  from tensorflow.python.eager import def_function
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import errors_impl
  from tensorflow.python.framework import ops
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import gen_array_ops
  from tensorflow.python.ops import gradient_checker
  from tensorflow.python.ops import gradients_impl
  from tensorflow.python.ops import math_ops
  from tensorflow.python.ops import nn_ops
  from tensorflow.python.ops import variables
  from tensorflow.python.platform import test
label_desc: Use image node_id 9 for calling the ConcatOpTest obj's underlying member method code with example usage: obj._testRandom(dtype) without return types