code: def test_msort(self, device, dtype):
      def test(shape):
          tensor = make_tensor(
              shape, dtype=dtype, device=device, low=-9, high=9
          )
          if tensor.size() != torch.Size([]):
              if dtype is torch.bfloat16:
                  expected = torch.from_numpy(
                      np.msort(tensor.float().cpu().numpy())
                  ).bfloat16()
              else:
                  expected = torch.from_numpy(
                      np.msort(tensor.cpu().numpy())
                  )
          else:
              expected = tensor  # numpy.msort() does not support empty shapes tensor
  
          result = torch.msort(tensor)
          self.assertEqual(result, expected)
  
          out = torch.empty_like(result)
          torch.msort(tensor, out=out)
          self.assertEqual(out, expected)
  
      shapes = (
          [],
          [
              0,
          ],
          [
              20,
          ],
          [1, 20],
          [30, 30],
          [10, 20, 30],
      )
      for shape in shapes:
          test(shape)
  
imports: import torch
  import numpy
  import random
  from torch import nan
  from itertools import permutations, product
  from torch.testing import make_tensor
  from torch.testing._internal.common_dtype import all_types, all_types_and, floating_types_and, integral_types
  from torch.testing._internal.common_utils import TestCase, run_tests, slowTest, skipIfTorchDynamo
  from torch.testing._internal.common_device_type import instantiate_device_type_tests, dtypes, onlyNativeDeviceTypes, onlyCUDA, dtypesIfCUDA, dtypesIfCPU, onlyCPU, largeTensorTest
label_desc: Use image node_id 15 for calling the TestSortAndSelect obj's underlying member method code with example usage: obj.test_msort(device, dtype) without return types