class_docstr: An embedding bag module attached with FakeQuantize modules for weight,
  used for quantization aware training.
  
  We adopt the same interface as `torch.nn.EmbeddingBag`, please see
  https://pytorch.org/docs/stable/generated/torch.nn.EmbeddingBag.html#torch.nn.EmbeddingBag
  for documentation.
  
  Similar to `torch.nn.EmbeddingBag`, with FakeQuantize modules initialized to
  default.
  
  Attributes:
      weight: fake quant module for weight
class_docstr_tok: ["An","embedding","bag","module","attached","with","FakeQuantize","modules","for","weight",",","used","for","quantization","aware","training",".","We","adopt","the","same","interface","as","`","torch.nn.EmbeddingBag","`",",","please","see","https",":","\/\/pytorch.org\/docs\/stable\/generated\/torch.nn.EmbeddingBag.html","#","torch.nn.EmbeddingBag","for","documentation",".","Similar","to","`","torch.nn.EmbeddingBag","`",",","with","FakeQuantize","modules","initialized","to","default",".","Attributes",":","weight",":","fake","quant","module","for","weight"]
docstr: Create a qat module from a float module
  
  Args: `mod` a float module, either produced by torch.ao.quantization utilities
  or directly from user
docstr_tok: ["Create","a","qat","module","from","a","float","module","Args",":","`","mod","`","a","float","module",",","either","produced","by","torch.ao.quantization","utilities","or","directly","from","user"]
code: def from_float(cls, mod):
      r"""Create a qat module from a float module
  
      Args: `mod` a float module, either produced by torch.ao.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"
      weight_qscheme = mod.qconfig.weight().qscheme  # type: ignore[union-attr, operator]
      assert weight_qscheme == torch.per_channel_affine_float_qparams, (
          "Embedding Bag weights requires a qscheme of torch.per_channel_affine_float_qparams Got "
          + str(weight_qscheme)
      )
  
      qconfig = mod.qconfig
      qat_embedding_bag = cls(
          mod.num_embeddings,
          mod.embedding_dim,
          mod.max_norm,
          mod.norm_type,
          mod.scale_grad_by_freq,
          mod.mode,
          mod.sparse,
          mod.weight,
          mod.include_last_offset,
          mod.padding_idx,
          qconfig=qconfig,
      )
  
      return qat_embedding_bag
  
file_path: pytorch/torch/ao/nn/qat/modules/embedding_ops.py
imports: import torch
  from torch import Tensor
  import torch.nn
  import torch.nn.functional
label_desc: Use image node_id 3 for calling the EmbeddingBag obj's underlying member method code with example usage: obj.from_float(cls, mod) and returns: qat_embedding_bag