code: def test_random_contrast(self):
      seed = 9809
      np.random.seed(seed)
      inputs = np.random.random((12, 8, 16, 3))
      layer = layers.RandomContrast(factor=0.5, seed=seed)
      outputs = layer(inputs)
  
      # Actual contrast arithmetic
      np.random.seed(seed)
      factor = np.random.uniform(0.5, 1.5)
      inp_mean = np.mean(inputs, axis=-3, keepdims=True)
      inp_mean = np.mean(inp_mean, axis=-2, keepdims=True)
      actual_outputs = (inputs - inp_mean) * factor + inp_mean
      outputs = backend.convert_to_numpy(outputs)
      actual_outputs = np.clip(outputs, 0, 255)
  
      self.assertAllClose(outputs, actual_outputs)
  
file_path: keras/keras/layers/preprocessing/random_contrast_test.py
imports: import numpy
  import pytest
  from tensorflow import data
  from keras import backend
  from keras import layers
  from keras import testing
label_desc: Use image node_id 2 for calling the RandomContrastTest obj's underlying member method code with example usage: obj.test_random_contrast() without return types