code: def _get_inv_square_matrices(draw):
      dim_size = draw(helpers.ints(min_value=1, max_value=9))
  
      batch_shape = draw(st.sampled_from([2, 4, 6, 8]))
  
      generated_shape = (dim_size,) * batch_shape
      generated_ind = int(np.floor(len(generated_shape) / 2))
  
      handpicked_shape, handpicked_ind = draw(
          st.sampled_from(
              [
                  [(24, 6, 4), 1],
                  [(8, 3, 6, 4), 2],
                  [(6, 7, 8, 16, 21), 3],
              ]
          )
      )
  
      shape, ind = draw(
          st.sampled_from(
              [
                  (generated_shape, generated_ind),
                  (handpicked_shape, handpicked_ind),
              ]
          )
      )
  
      input_dtype = draw(
          helpers.get_dtypes("float", index=1, full=False).filter(
              lambda x: x not in ["float16", "bfloat16"]
          )
      )
      invertible = False
      while not invertible:
          a = draw(
              helpers.array_values(
                  dtype=input_dtype[0],
                  shape=shape,
                  large_abs_safety_factor=24,
                  small_abs_safety_factor=24,
                  safety_factor_scale="log",
              ).filter(lambda x: helpers.matrix_is_stable(x))
          )
          try:
              np.linalg.tensorinv(a, ind)
              invertible = True
          except np.linalg.LinAlgError:
              pass
  
      return input_dtype, a, ind
  
imports: import sys
  import numpy
  from hypothesis import strategies, assume
  import ivy_tests.test_ivy.helpers
  from ivy_tests.test_ivy.helpers import assert_all_close, handle_frontend_test, BackendHandler
  from ivy_tests.test_ivy.test_functional.test_core.test_linalg import _get_dtype_and_matrix, _matrix_rank_helper
  from ivy_tests.test_ivy.helpers.hypothesis_helpers.general_helpers import matrix_is_stable
label_desc: Use image node_id 1 for calling a global function with example usage: _get_inv_square_matrices(draw) and returns: input_dtype,  a,  ind