code: def test_unique_1d_2(self):
      # test for ticket 2111 - float
      a = [2.0, np.nan, 1.0, np.nan]
      ua = [1.0, 2.0, np.nan]
      ua_idx = [2, 0, 1]
      ua_inv = [1, 2, 0, 2]
      ua_cnt = [1, 1, 2]
      assert_equal(np.unique(a), ua)
      assert_equal(np.unique(a, return_index=True), (ua, ua_idx))
      assert_equal(np.unique(a, return_inverse=True), (ua, ua_inv))
      assert_equal(np.unique(a, return_counts=True), (ua, ua_cnt))
  
      # test for ticket 2111 - complex
      a = [
          2.0 - 1j,
          np.nan,
          1.0 + 1j,
          complex(0.0, np.nan),
          complex(1.0, np.nan),
      ]
      ua = [1.0 + 1j, 2.0 - 1j, complex(0.0, np.nan)]
      ua_idx = [2, 0, 3]
      ua_inv = [1, 2, 0, 2, 2]
      ua_cnt = [1, 1, 3]
      assert_equal(np.unique(a), ua)
      assert_equal(np.unique(a, return_index=True), (ua, ua_idx))
      assert_equal(np.unique(a, return_inverse=True), (ua, ua_inv))
      assert_equal(np.unique(a, return_counts=True), (ua, ua_cnt))
  
      # test for gh-19300
      all_nans = [np.nan] * 4
      ua = [np.nan]
      ua_idx = [0]
      ua_inv = [0, 0, 0, 0]
      ua_cnt = [4]
      assert_equal(np.unique(all_nans), ua)
      assert_equal(np.unique(all_nans, return_index=True), (ua, ua_idx))
      assert_equal(
          np.unique(all_nans, return_inverse=True), (ua, ua_inv)
      )
      assert_equal(
          np.unique(all_nans, return_counts=True), (ua, ua_cnt)
      )
  
imports: from unittest import skipIf
  import numpy
  from pytest import raises
  from torch.testing._internal.common_utils import instantiate_parametrized_tests, parametrize, run_tests, subtest, TEST_WITH_TORCHDYNAMO, TestCase, xpassIfTorchDynamo
label_desc: Use image node_id 2 for calling the TestUnique obj's underlying member method code with example usage: obj.test_unique_1d_2() without return types