code: def test_upsampling_2d(self, data_format, length_row, length_col):
      num_samples = 2
      stack_size = 2
      input_num_row = 11
      input_num_col = 12
  
      if data_format == "channels_first":
          inputs = np.random.rand(
              num_samples, stack_size, input_num_row, input_num_col
          )
      else:
          inputs = np.random.rand(
              num_samples, input_num_row, input_num_col, stack_size
          )
  
      # basic test
      self.run_layer_test(
          layers.UpSampling2D,
          init_kwargs={"size": (2, 2), "data_format": data_format},
          input_shape=inputs.shape,
      )
  
      layer = layers.UpSampling2D(
          size=(length_row, length_col),
          data_format=data_format,
      )
      layer.build(inputs.shape)
      np_output = layer(inputs=backend.Variable(inputs))
      if data_format == "channels_first":
          assert np_output.shape[2] == length_row * input_num_row
          assert np_output.shape[3] == length_col * input_num_col
      else:
          assert np_output.shape[1] == length_row * input_num_row
          assert np_output.shape[2] == length_col * input_num_col
  
      # compare with numpy
      if data_format == "channels_first":
          expected_out = np.repeat(inputs, length_row, axis=2)
          expected_out = np.repeat(expected_out, length_col, axis=3)
      else:
          expected_out = np.repeat(inputs, length_row, axis=1)
          expected_out = np.repeat(expected_out, length_col, axis=2)
  
      self.assertAllClose(np_output, expected_out)
  
file_path: keras/keras/layers/reshaping/up_sampling2d_test.py
imports: import numpy
  import pytest
  from absl.testing import parameterized
  from keras import backend
  from keras import layers
  from keras import testing
label_desc: Use image node_id 1 for calling the UpSampling2dTest obj's underlying member method code with example usage: obj.test_upsampling_2d(data_format, length_row, length_col) without return types