def test_get_weights_metadata():
        """
        Test the example in the get_weights_metadata functionality with op_type is None.
        """
        model, inputs, torch_input_values, coreml_input_values = get_test_model_and_data_complex()

        weight_1_sparse = create_sparse_weight(model.conv_1.weight, 0.5)
        weight_2_sparse = create_sparse_weight(model.conv_2.weight, 0.8)
        linear_1_palettized = create_unique_weight(model.linear_1.weight, 2)
        linear_2_palettized = create_unique_weight(model.linear_2.weight, 4)

        with torch.no_grad():
            model.conv_1.weight = torch.nn.Parameter(torch.Tensor(weight_1_sparse))
            model.conv_2.weight = torch.nn.Parameter(torch.Tensor(weight_2_sparse))
            model.linear_1.weight = torch.nn.Parameter(torch.Tensor(linear_1_palettized))
            model.linear_2.weight = torch.nn.Parameter(torch.Tensor(linear_2_palettized))

        torchmodel = torch.jit.trace(model, torch_input_values)

        mlmodel = ct.convert(
            torchmodel,
            inputs=inputs,
            convert_to="mlprogram",
            compute_precision=ct.precision.FLOAT32,
            minimum_deployment_target=ct.target.iOS16,
        )

        # test the weight_threshold can filter out weights with size
        weight_threshold = 10
        weight_metadata_dict = ct.optimize.coreml.get_weights_metadata(
            mlmodel, weight_threshold=weight_threshold
        )
        for v in weight_metadata_dict.values():
            assert v.val.size >= weight_threshold

        # test the functionality of using the returned meta data
        weight_metadata_dict = ct.optimize.coreml.get_weights_metadata(mlmodel)

        # get the weight names with size > 25600
        large_weights = []
        for k, v in weight_metadata_dict.items():
            if v.val.size >= 25600:
                large_weights.append(k)

        # get the weight names with sparsity >= 50%
        sparse_weights = []
        for k, v in weight_metadata_dict.items():
            if v.sparsity >= 0.5:
                sparse_weights.append(k)

        # get the weight names with unique elements <= 16
        palettized_weights = []
        for k, v in weight_metadata_dict.items():
            if v.unique_values <= 16:
                palettized_weights.append(k)

        meta_data_1 = weight_metadata_dict["conv_1_weight"]

        # testing
        expected_large_weights = [
            "linear_2_weight",
            "concat_1",
            "concat_2",
        ]
        assert large_weights == expected_large_weights

        expected_sparse_weights = [
            "conv_1_weight",
            "conv_2_weight",
            "op_59_lstm_h0_squeeze",
        ]
        assert sparse_weights == expected_sparse_weights

        expected_palettized_weights = [
            "linear_1_weight",
            "linear_2_weight",
            "op_59_lstm_h0_squeeze",
        ]
        assert palettized_weights == expected_palettized_weights

        Test the example in the get_weights_metadata functionality with op_type is None.
        
coremltools/test/optimize/coreml/test_post_training_quantization.py