code: def _instance_and_batch_norm_helper(
      draw, *, min_dims=1, test_function="instance_norm"
  ):
      mixed_fn_compos = draw(st.booleans())
      is_torch_backend = ivy.current_backend_str() == "torch"
      data_format = draw(st.sampled_from(["NSC", "NCS"]))
      shape1, shape2, shape3, shape4 = draw(
          helpers.mutually_broadcastable_shapes(
              num_shapes=4, min_dims=min_dims, min_side=2
          )
      )
      shape = helpers.broadcast_shapes(shape1, shape2, shape3, shape4)
  
      if (test_function == "instance_norm") or (
          is_torch_backend and not mixed_fn_compos
      ):
          shape1 = shape2 = shape3 = shape4 = (shape[-1],)
  
      if data_format == "NCS":
          shape = (shape[0], shape[-1], *shape[1:-1])
  
      x_dtype, x = draw(
          helpers.dtype_and_values(
              available_dtypes=helpers.get_dtypes(
                  "float",
                  mixed_fn_compos=mixed_fn_compos,
              ),
              large_abs_safety_factor=24,
              small_abs_safety_factor=24,
              safety_factor_scale="log",
              shape=shape,
              max_value=999,
              min_value=-1001,
          )
      )
  
      _, mean = draw(
          helpers.dtype_and_values(
              dtype=x_dtype,
              shape=shape1,
              min_value=-1001,
              max_value=999,
              large_abs_safety_factor=24,
              small_abs_safety_factor=24,
              safety_factor_scale="log",
          )
      )
      _, variance = draw(
          helpers.dtype_and_values(
              dtype=x_dtype,
              shape=shape2,
              min_value=0,
              max_value=999,
              large_abs_safety_factor=24,
              small_abs_safety_factor=24,
              safety_factor_scale="log",
          )
      )
      _, offset = draw(
          st.one_of(
              helpers.dtype_and_values(
                  dtype=x_dtype,
                  shape=shape3,
                  min_value=-1001,
                  max_value=999,
                  large_abs_safety_factor=24,
                  small_abs_safety_factor=24,
                  safety_factor_scale="log",
              ),
              st.just(([None], [None])),
          )
      )
      _, scale = draw(
          st.one_of(
              helpers.dtype_and_values(
                  dtype=x_dtype,
                  shape=shape4,
                  min_value=-1001,
                  max_value=999,
                  large_abs_safety_factor=24,
                  small_abs_safety_factor=24,
                  safety_factor_scale="log",
              ),
              st.just(([None], [None])),
          )
      )
      eps = draw(
          helpers.floats(
              min_value=1e-5,
              max_value=0.1,
              mixed_fn_compos=mixed_fn_compos,
          )
      )
      momentum = draw(
          helpers.floats(
              min_value=0.0,
              max_value=1.0,
              mixed_fn_compos=mixed_fn_compos,
          )
      )
      return (
          x_dtype,
          x[0],
          mean[0],
          variance[0],
          offset[0],
          scale[0],
          eps,
          momentum,
          data_format,
      )
  
file_path: ivy/ivy_tests/test_ivy/test_functional/test_experimental/test_nn/test_norms.py
imports: from hypothesis import strategies
  import ivy_tests.test_ivy.helpers
  from ivy_tests.test_ivy.helpers import handle_test
  import ivy
label_desc: Use image node_id 2 for calling a global function with example usage: _instance_and_batch_norm_helper(draw) and returns: x_dtype,  x,  mean,  variance,  offset,  scale,  eps,  momentum,  data_format