def test_obs_compression_algorithm_config(global_config_and_class):
    """
    Test the registry-based configuration of the :py:class:`LayerwiseCompressionAlgorithmConfig`
    using :py:class:`LayerwiseCompressorConfig`
    """

    global_config, class_type = global_config_and_class
    # compress
    config = LayerwiseCompressorConfig.from_dict(
        {
            "global_config": global_config,
            "input_cacher": "default",
            "calibration_nsamples": 128,
        }
    )
    algo = global_config.get("algorithm")
    algo_class = LayerwiseCompressionAlgorithmConfig.get_class(algo)
    assert algo_class == class_type
    assert isinstance(config.global_config, class_type)

    Test the registry-based configuration of the :py:class:`LayerwiseCompressionAlgorithmConfig`
    using :py:class:`LayerwiseCompressorConfig`
    
coremltools/test/optimize/torch/layerwise_compression/test_algorithms.py