code: def test_movedim_invalid(self, device, dtype):
      shape = self._rand_shape(4, min_size=5, max_size=10)
      x = _generate_input(shape, dtype, device, False)
  
      for fn in [torch.movedim, torch.moveaxis]:
          # Invalid `source` and `destination` dimension
          with self.assertRaisesRegex(
              IndexError, "Dimension out of range"
          ):
              fn(x, 5, 0)
  
          with self.assertRaisesRegex(
              IndexError, "Dimension out of range"
          ):
              fn(x, 0, 5)
  
          # Mismatch in size of `source` and `destination`
          with self.assertRaisesRegex(
              RuntimeError,
              "movedim: Invalid source or destination dims:",
          ):
              fn(x, (1, 0), (0,))
  
          with self.assertRaisesRegex(
              RuntimeError, "movedim: repeated dim in `source`"
          ):
              fn(x, (0, 0), (0, 1))
  
          with self.assertRaisesRegex(
              RuntimeError, "movedim: repeated dim in `source`"
          ):
              fn(x, (0, 1, 0), (0, 1, 2))
  
          with self.assertRaisesRegex(
              RuntimeError, "movedim: repeated dim in `destination`"
          ):
              fn(x, (0, 1), (1, 1))
  
          with self.assertRaisesRegex(
              RuntimeError, "movedim: repeated dim in `destination`"
          ):
              fn(x, (0, 1, 2), (1, 0, 1))
  
imports: import torch
  import numpy
  from itertools import product, combinations, permutations, chain
  from functools import partial
  import random
  import warnings
  import unittest
  from torch import nan
  from torch.testing import make_tensor
  from torch.testing._internal.common_utils import TestCase, run_tests, skipIfTorchDynamo, torch_to_numpy_dtype_dict, IS_JETSON
  from torch.testing._internal.common_device_type import instantiate_device_type_tests, onlyCPU, onlyCUDA, dtypes, onlyNativeDeviceTypes, dtypesIfCUDA, largeTensorTest
  from torch.testing._internal.common_dtype import all_types_and_complex_and, all_types, all_types_and
label_desc: Use image node_id 3 for calling the TestShapeOps obj's underlying member method code with example usage: obj.test_movedim_invalid(device, dtype) without return types