code: def _input_array(num_dims):
      """Creates an ndarray where each element is the binary of its linear index.
  
      Args:
        num_dims: The number of dimensions to create.
  
      Returns:
        An ndarray of shape [2] * num_dims.
      """
      formatter = "{:0%db}" % num_dims
      strings = [formatter.format(i) for i in range(2**num_dims)]
      return np.array(strings, dtype="S%d" % num_dims).reshape(
          [2] * num_dims
      )
  
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 1 for calling a global function with example usage: _input_array(num_dims) and returns: np