docstr: 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
docstr_tok: ["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"]
code: def from_float(cls, mod):
      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
  
imports: import torch
  import torch.nn
  import torch.nn.functional
  from .palettization_config import SUPPORTED_PYTORCH_QAT_MODULES
label_desc: Use image node_id 2 for calling the Conv1d obj's underlying member method code with example usage: obj.from_float(cls, mod) and returns: qat