code: def _joined_array(num_dims, reduce_dim):
      """Creates an ndarray with the result from reduce_join on input_array.
  
      Args:
        num_dims: The number of dimensions of the original input array.
        reduce_dim: The dimension to reduce.
  
      Returns:
        An ndarray of shape [2] * (num_dims - 1).
      """
      formatter = "{:0%db}" % (num_dims - 1)
      result = np.zeros(
          shape=[2] * (num_dims - 1), dtype="S%d" % (2 * num_dims)
      )
      flat = result.ravel()
      for i in range(2 ** (num_dims - 1)):
          dims = formatter.format(i)
          flat[i] = "".join(
              [
                  (dims[:reduce_dim] + "%d" + dims[reduce_dim:]) % j
                  for j in range(2)
              ]
          )
      return result
  
imports: import itertools
  import numpy
  from tensorflow.python.framework import constant_op
  from tensorflow.python.framework import dtypes
  from tensorflow.python.framework import test_util
  from tensorflow.python.ops import array_ops
  from tensorflow.python.ops import string_ops
  from tensorflow.python.platform import test
label_desc: Use image node_id 2 for calling a global function with example usage: _joined_array(num_dims, reduce_dim) and returns: result