code: def test_zi_nd(self, size, sections, axis, dtype, xp, scp):
      if xp.dtype(dtype).kind in {"i", "u"}:
          pytest.skip()
  
      x_scale = 0.5 if xp.dtype(dtype).kind not in {"i", "u"} else 1
      c_scale = 0.2 if xp.dtype(dtype).kind not in {"i", "u"} else 1
  
      x = testing.shaped_random(
          (
              4,
              5,
              3,
              size,
          ),
          xp,
          dtype,
          scale=x_scale,
      )
      sos = testing.shaped_random(
          (sections, 6), xp, dtype, scale=c_scale
      )
      sos[:, 3] = 1
  
      zi_size = [sections] + list(x.shape)
      zi_size[axis + 1] = 4
      zi = testing.shaped_random(zi_size, xp, dtype, scale=x_scale)
  
      if xp is not cupy:
          sections_zi = []
          for s in range(sections):
              b = sos[s, :3]
              a = sos[s, 3:]
              section_zi = zi[s]
              section_zi = xp.moveaxis(section_zi, axis, -1)
              zi_m_shape = section_zi.shape
              section_zi = section_zi.reshape(-1, 4).copy()
              section_zi = xp.concatenate(
                  [
                      scp.signal.lfiltic(b, a, z[2:][::-1], z[:2][::-1])
                      for z in section_zi
                  ]
              )
              section_zi = section_zi.reshape(zi_m_shape[:-1] + (2,))
              section_zi = xp.moveaxis(section_zi, -1, axis)
              sections_zi.append(xp.expand_dims(section_zi, 0))
          zi = xp.concatenate(sections_zi)
          out, _ = scp.signal.sosfilt(sos, x, zi=zi, axis=axis)
      else:
          out, _ = apply_iir_sos(x, sos, zi=zi, axis=axis, block_sz=32)
      return out
  
file_path: cupy/tests/cupyx_tests/scipy_tests/signal_tests/test_iir_utils.py
imports: import pytest
  import cupy
  from cupy.cuda import driver
  from cupy.cuda import runtime
  from cupy import testing
  from cupyx.scipy.signal._iir_utils import apply_iir, apply_iir_sos
label_desc: Use image node_id 6 for calling the TestIIRUtilSos obj's underlying member method code with example usage: obj.test_zi_nd(size, sections, axis, dtype, xp, scp) and returns: out