code: def linear_quantize_weights(mlmodel, mode="linear", dtype=np.int8):
      op_config = cto.coreml.OpLinearQuantizerConfig(
          mode=mode, dtype=dtype
      )
      config = cto.coreml.OptimizationConfig(global_config=op_config)
      return cto.coreml.linear_quantize_weights(mlmodel, config)
  
imports: import itertools
  import numpy
  import pytest
  import torch
  import coremltools
  import coremltools.optimize
  from coremltools._deps import _HAS_SKLEARN
  from coremltools.converters.mil.mil import Builder
  from coremltools.converters.mil.mil import types
  from coremltools.converters.mil.testing_utils import get_op_types_in_program
  from coremltools.optimize.coreml._post_training_quantization import CoreMLWeightMetaData
  from coremltools.test.ml_program.test_compression import get_test_model_and_data
label_desc: Use image node_id 1 for calling a global function with example usage: linear_quantize_weights(mlmodel, mode, dtype) and returns: cto