def _get_observer_setting(observer):
    r"""
    Convert torch observer's args to dict for saving to json file.
    Because json only accept number or string, so we will convert some
    class type to string(dtype, qscheme, other class type?).
    """
    observer_setting = OrderedDict()
    observer_setting["name"] = observer.__class__.__name__
    # get observer arg name
    observer_args = inspect.signature(observer.__init__).parameters
    observer_dict = observer.__dict__
    # Now we only can save number or string to json file.
    for arg_name in observer_args.keys():
        if arg_name in observer_dict:
            if isinstance(observer_dict[arg_name], numbers.Number):
                observer_setting[arg_name] = observer_dict[arg_name]
            elif arg_name == "qscheme" or arg_name == "dtype":
                observer_setting[arg_name] = str(observer_dict[arg_name])
            elif (
                arg_name == "eps"
                and hasattr(observer, "eps")
                and isinstance(observer.eps, torch.Tensor)
                and observer.eps.numel() == 1
            ):
                observer_setting[arg_name] = observer.eps.item()
    return observer_setting

    Convert torch observer's args to dict for saving to json file.
    Because json only accept number or string, so we will convert some
    class type to string(dtype, qscheme, other class type?).
    
intel_extension_for_pytorch/quantization/_utils.py