code: def test_preprocess_input_symbolic(self, mode):
      backend_data_format = backend.image_data_format()
      # Test image batch
      if backend_data_format == "channels_last":
          x = np.random.uniform(0, 255, (2, 10, 10, 3))
      elif backend_data_format == "channels_first":
          x = np.random.uniform(0, 255, (2, 3, 10, 10))
      inputs = keras.layers.Input(shape=x.shape[1:])
      outputs = keras.layers.Lambda(
          lambda x: utils.preprocess_input(x, mode=mode),
          output_shape=x.shape[1:],
      )(inputs)
      model = keras.Model(inputs, outputs)
      self.assertEqual(model.predict(x).shape, x.shape)
  
      x = np.random.uniform(0, 255, (2, 10, 10, 3))
      inputs = keras.layers.Input(shape=x.shape[1:])
      outputs1 = keras.layers.Lambda(
          lambda x: utils.preprocess_input(
              x, "channels_last", mode=mode
          ),
          output_shape=x.shape[1:],
      )(inputs)
      model1 = keras.Model(inputs, outputs1)
      out1 = model1.predict(x)
      x2 = np.transpose(x, (0, 3, 1, 2))
      inputs2 = keras.layers.Input(shape=x2.shape[1:])
      outputs2 = keras.layers.Lambda(
          lambda x: utils.preprocess_input(
              x, "channels_first", mode=mode
          ),
          output_shape=x2.shape[1:],
      )(inputs2)
      model2 = keras.Model(inputs2, outputs2)
      out2 = model2.predict(x2)
      self.assertAllClose(out1, out2.transpose(0, 2, 3, 1))
  
      # Test single image
      if backend_data_format == "channels_last":
          x = np.random.uniform(0, 255, (10, 10, 3))
      elif backend_data_format == "channels_first":
          x = np.random.uniform(0, 255, (3, 10, 10))
      inputs = keras.layers.Input(shape=x.shape)
      outputs = keras.layers.Lambda(
          lambda x: utils.preprocess_input(x, mode=mode),
          output_shape=x.shape,
      )(inputs)
      model = keras.Model(inputs, outputs)
      self.assertEqual(model.predict(x[np.newaxis])[0].shape, x.shape)
  
      x = np.random.uniform(0, 255, (10, 10, 3))
      inputs = keras.layers.Input(shape=x.shape)
      outputs1 = keras.layers.Lambda(
          lambda x: utils.preprocess_input(
              x, "channels_last", mode=mode
          ),
          output_shape=x.shape,
      )(inputs)
      model1 = keras.Model(inputs, outputs1)
      out1 = model1.predict(x[np.newaxis])[0]
      x2 = np.transpose(x, (2, 0, 1))
      inputs2 = keras.layers.Input(shape=x2.shape)
      outputs2 = keras.layers.Lambda(
          lambda x: utils.preprocess_input(
              x, "channels_first", mode=mode
          ),
          output_shape=x2.shape,
      )(inputs2)
      model2 = keras.Model(inputs2, outputs2)
      out2 = model2.predict(x2[np.newaxis])[0]
      self.assertAllClose(out1, out2.transpose(1, 2, 0))
  
file_path: keras/keras/applications/imagenet_utils_test.py
imports: import numpy
  import pytest
  from absl.testing import parameterized
  import keras
  from keras import backend
  from keras import testing
  from keras.applications import imagenet_utils
  from keras.mixed_precision import set_dtype_policy
label_desc: Use image node_id 2 for calling the TestImageNetUtils obj's underlying member method code with example usage: obj.test_preprocess_input_symbolic(mode) without return types