code: def test_assert_allclose(shape, transpose, dtype1, dtype2):
      atol = (
          1e-3 if numpy.dtype("float16") in [dtype1, dtype2] else 1e-5
      )
  
      np_a = (
          numpy.arange(2, 2 + numpy.prod(shape))
          .astype(dtype1)
          .reshape(shape)
      )
      if transpose:
          np_b = numpy.empty(np_a.T.shape, dtype=dtype2).T
          np_b[:] = np_a
      else:
          np_b = (
              numpy.arange(2, 2 + numpy.prod(shape))
              .astype(dtype2)
              .reshape(shape)
          )
  
      # Give some perturbation only if dtype is float
      if np_a.dtype.kind in ("f", "c"):
          np_a += atol * 1e-1
      if np_b.dtype.kind in ("f", "c"):
          np_b -= atol * 1e-1
  
      chx_a = chainerx.array(np_a)
      chx_b = chainerx.array(np_b)
  
      # Test precondition checks
      assert np_a.shape == np_b.shape
      if transpose:
          assert (
              np_a.strides != np_b.strides
          ), "transpose=True is meaningless"
  
      # Test checks
      chainerx.testing.assert_allclose(
          np_a, np_a, atol=atol
      )  # np-np (same obj)
      chainerx.testing.assert_allclose(
          chx_a, chx_a, atol=atol
      )  # chx-chx (same obj)
      chainerx.testing.assert_allclose(
          np_a, np_b, atol=atol
      )  # np-np (diff. obj)
      chainerx.testing.assert_allclose(
          chx_a, chx_b, atol=atol
      )  # chx-chx (diff. obj)
      chainerx.testing.assert_allclose(np_a, chx_b, atol=atol)  # np-chx
      chainerx.testing.assert_allclose(chx_a, np_b, atol=atol)
  
imports: import numpy
  import pytest
  import chainerx
  import chainerx.testing
label_desc: Use image node_id 6 for calling a global function with example usage: test_assert_allclose(shape, transpose, dtype1, dtype2) without return types