code: def test_dynamic_partition_2D():
      data = torch.Tensor(
          [
              [1, 2, 3, 4, 5, 6, 7, 8, 9],
              [10, 11, 12, 13, 14, 15, 16, 17, 18],
          ]
      )
      partitions = torch.Tensor(
          [[1, 1, 1, 1, 1, 1, 1, 1, 0], [1, 1, 1, 1, 1, 1, 1, 1, 0]]
      )
  
      partitioned_data = metric_utils.dynamic_partition(
          data, partitions, 2
      )
  
      assert torch.equal(partitioned_data[0], torch.Tensor([9, 18]))
      assert torch.equal(
          partitioned_data[1],
          torch.Tensor(
              [
                  1.0,
                  2.0,
                  3.0,
                  4.0,
                  5.0,
                  6.0,
                  7.0,
                  8.0,
                  10.0,
                  11.0,
                  12.0,
                  13.0,
                  14.0,
                  15.0,
                  16.0,
                  17.0,
              ]
          ),
      )
  
file_path: ludwig/tests/ludwig/utils/test_metric_utils.py
imports: from collections import OrderedDict
  import torch
  from ludwig.utils import metric_utils
  from ludwig.utils.metric_utils import TrainerMetric
label_desc: Use image node_id 2 for calling a global function with example usage: test_dynamic_partition_2D() without return types