class_docstr: This test includes unit tests for:
  1. CoreMLWeightMetaData
  2. coremltools.optimize.coreml.get_weights_metadata
class_docstr_tok: ["This","test","includes","unit","tests","for",":","1",".","CoreMLWeightMetaData","2.","coremltools.optimize.coreml.get_weights_metadata"]
docstr: Test the example in the CoreMLWeightMetaData api doc string.
docstr_tok: ["Test","the","example","in","the","CoreMLWeightMetaData","api","doc","string","."]
code: def test_coreml_weight_metadata_api():
      """
      Test the example in the CoreMLWeightMetaData api doc string.
      """
      data = np.array([[1.0, 0.0], [0.0, 6.0]], dtype=np.float32)
      meta_data = CoreMLWeightMetaData(data)
      assert meta_data.val is data
      assert meta_data.sparsity == 0.5
      assert meta_data.unique_values == 3
  
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 the TestCoreMLWeightMetaData obj's underlying member method code with example usage: obj.test_coreml_weight_metadata_api() without return types