code: def test_shape_4d(self):
      # All possible permutations for bins of different lengths in 4D.
      bins = (
          (7, 4, 5, 6),
          (4, 5, 7, 6),
          (5, 6, 4, 7),
          (7, 6, 5, 4),
          (5, 7, 6, 4),
          (4, 6, 7, 5),
          (6, 5, 7, 4),
          (7, 5, 4, 6),
          (7, 4, 6, 5),
          (6, 4, 7, 5),
          (6, 7, 5, 4),
          (4, 6, 5, 7),
          (4, 7, 5, 6),
          (5, 4, 6, 7),
          (5, 7, 4, 6),
          (6, 7, 4, 5),
          (6, 5, 4, 7),
          (4, 7, 6, 5),
          (4, 5, 6, 7),
          (7, 6, 4, 5),
          (5, 4, 7, 6),
          (5, 6, 7, 4),
          (6, 4, 5, 7),
          (7, 5, 6, 4),
      )
  
      r = np.random.rand(10, 4)
      for b in bins:
          H, edges = histogramdd(r, b)
          assert_(H.shape == b)
  
          h1, e1 = histogramdd(r, b, weights=np.ones(10))
          assert_equal(H, h1)
          for edge, e in zip(edges, e1):
              assert (edge == e).all()
  
imports: import functools
  from unittest import expectedFailure, skipIf
  from pytest import raises
  from torch.testing._internal.common_utils import instantiate_parametrized_tests, parametrize, run_tests, slowTest, TEST_WITH_TORCHDYNAMO, TestCase, xpassIfTorchDynamo
label_desc: Use image node_id 3 for calling the TestHistogramdd obj's underlying member method code with example usage: obj.test_shape_4d() without return types