def test_single_act_qscheme_for_symmetric(algorithm, activation_fn, layer_and_data, bn):
    """
    Tests that when qscheme is symmetric, always affine layers have affine qscheme
    """
    layer, data = layer_and_data
    if (isinstance(layer, nn.Conv2d) or isinstance(layer, nn.ConvTranspose2d)) and bn is not None:
        model = nn.Sequential(
            OrderedDict(
                {
                    "layer": layer,
                    "bn": bn,
                    "act": activation_fn(),
                }
            )
        )
    else:
        model = nn.Sequential(OrderedDict({
            'layer': layer,
            'act': activation_fn(),
        }))

    config = LinearQuantizerConfig()
    config.global_config.algorithm = algorithm
    prepared_model, _ = quantize_model(model, data, config)

    assert prepared_model.activation_post_process_0.qscheme == torch.per_tensor_symmetric
    assert prepared_model.activation_post_process_1.qscheme == torch.per_tensor_affine

    Tests that when qscheme is symmetric, always affine layers have affine qscheme
    
coremltools/test/optimize/torch/quantization/test_configure.py