def from_float(cls, mod: _nn.Module) -> _nn.Module:
        r"""Create a qat module from a float module or qparams_dict

        Args: `mod` a float module, either produced by torch.quantization utilities
        or directly from user
        """
        assert type(mod) == cls._FLOAT_MODULE, (
            "qat." + cls.__name__ + ".from_float only works for " + cls._FLOAT_MODULE.__name__
        )
        assert hasattr(mod, "qconfig"), "Input float module must have qconfig defined"
        assert mod.qconfig, "Input float module must have a valid qconfig"

        qconfig = mod.qconfig
        qat = cls(
            mod.in_channels,
            mod.out_channels,
            mod.kernel_size,
            stride=mod.stride,
            padding=mod.padding,
            dilation=mod.dilation,
            groups=mod.groups,
            bias=mod.bias is not None,
            padding_mode=mod.padding_mode,
        )
        qat.qconfig = qconfig
        qat.weight_fake_quant = qconfig.weight()

        wnorm = None

        for k, hook in mod._forward_pre_hooks.items():
            if "WeightNorm" in str(hook):
                wnorm = hook

        if wnorm:
            qat = _nn.utils.weight_norm(qat, name=wnorm.name, dim=wnorm.dim)

        for name, param in mod.named_parameters(recurse=False):
            setattr(qat, name, param)

        if wnorm:
            _nn.utils.remove_weight_norm(mod)

        return qat
Create a qat module from a float module or qparams_dict

        Args: `mod` a float module, either produced by torch.quantization utilities
        or directly from user
        
coremltools/optimize/torch/palettization/_supported_modules.py