def _create_observer(setting):
    r"""
    Create torch observer according to user's setting.
    """
    if "qscheme" in setting:
        setting["qscheme"] = qscheme_dict[setting["qscheme"]]
    if "dtype" in setting:
        setting["dtype"] = dtype_dict[setting["dtype"]]

    if hasattr(torch.quantization.observer, setting["name"]):
        observer = getattr(torch.quantization.observer, setting["name"])
        setting.pop("name", None)
        return observer.with_args(**setting)
    elif setting["name"] in IPEX_OBSERVERS:
        observer = IPEX_OBSERVERS[setting["name"]]
        setting.pop("name", None)
        # SmoothQuant observers contain sub-observers
        smooth_quant_sub_obs_keys = [
            "act_observer",
            "act_ic_observer",
            "wei_observer",
            "wei_ic_observer",
        ]
        for key in smooth_quant_sub_obs_keys:
            if key in setting:
                setting[key] = _create_observer(setting[key])
        return observer.with_args(**setting)
    else:
        raise NameError("torch.quantization.observer %s not found" % setting["name"])

    Create torch observer according to user's setting.
    
intel_extension_for_pytorch/quantization/_utils.py