code: def verify_image_scaler(
      input_dim,
      blue_bias=0.0,
      green_bias=0.0,
      red_bias=0.0,
      image_scale=1.0,
  ):
      """Verify image scaler"""
      dtype = "float32"
      a_np = np.random.uniform(size=input_dim).astype(dtype)
      # make sure it is valid image format CHW.
      assert len(a_np.shape) == 3 and a_np.shape[0] == 3
      b_np = np.zeros(a_np.shape, dtype=dtype)
      b_np[0, :, :] = image_scale * a_np[0, :, :] + blue_bias
      b_np[1, :, :] = image_scale * a_np[1, :, :] + green_bias
      b_np[2, :, :] = image_scale * a_np[2, :, :] + red_bias
      b_np = np.add(a_np, b_np)
      inputs = [
          ("input1", datatypes.Array(*input_dim)),
          ("input2", datatypes.Array(*input_dim)),
      ]
      output = [("output", datatypes.Array(*b_np.shape))]
      builder = NeuralNetworkBuilder(inputs, output)
      builder.set_pre_processing_parameters(
          image_input_names=["input1"],
          is_bgr=True,
          blue_bias=blue_bias,
          green_bias=green_bias,
          red_bias=red_bias,
          image_scale=image_scale,
      )
      # add one add layer to make CoreML model format valid
      # add layer has been tested before.
      builder.add_elementwise(
          name="add",
          input_names=["input1", "input2"],
          output_name="output",
          alpha=0,
          mode="ADD",
      )
      model = cm.models.MLModel(builder.spec)
      for target, dev in tvm.testing.enabled_targets():
          out = run_tvm_graph(
              model,
              target,
              dev,
              [a_np, a_np],
              ["input1", "input2"],
              b_np.shape,
              dtype,
          )
          tvm.testing.assert_allclose(out, b_np, rtol=1e-5)
  
imports: from os import path
  from enum import Enum
  import tempfile
  import numpy
  import model_zoo
  import coremltools
  from coremltools.models.neural_network import NeuralNetworkBuilder
  from coremltools.models import datatypes
  from tensorflow import keras
  import tvm
  import tvm.topi.testing
  import tvm.testing
  from tvm.contrib import graph_executor
  from tvm.topi.testing import conv2d_nchw_python
  from tvm import relay
label_desc: Use image node_id 38 for calling a global function with example usage: verify_image_scaler(input_dim, blue_bias, green_bias, red_bias, image_scale) without return types