code: def prepare_qat(model, mapping=None, inplace=False):
      r"""
      Prepares a copy of the model for quantization calibration or
      quantization-aware training and converts it to quantized version.
  
      Quantization configuration should be assigned preemptively
      to individual submodules in `.qconfig` attribute.
  
      Args:
          model: input model to be modified in-place
          mapping: dictionary that maps float modules to quantized modules to be
                   replaced.
          inplace: carry out model transformations in-place, the original module
                   is mutated
      """
      torch._C._log_api_usage_once(
          "quantization_api.quantize.prepare_qat"
      )
      assert (
          model.training
      ), "prepare_qat only works on models in training mode"
      if mapping is None:
          mapping = get_default_qat_module_mappings()
  
      if not inplace:
          model = copy.deepcopy(model)
  
      propagate_qconfig_(model, qconfig_dict=None)
      convert(
          model, mapping=mapping, inplace=True, remove_qconfig=False
      )
      prepare(
          model,
          observer_non_leaf_module_list=set(mapping.values()),
          inplace=True,
      )
      return model
  
imports: import copy
  import itertools
  import warnings
  import torch
  import torch.nn
  import torch.ao.nn.quantized
  from torch.ao.nn.intrinsic import _FusedModule
  from torch.ao.quantization.quantization_mappings import get_default_dynamic_quant_module_mappings, get_default_static_quant_module_mappings, get_default_static_quant_reference_module_mappings, get_default_qat_module_mappings, get_default_qconfig_propagation_list, no_observer_set, _has_special_act_post_process, _get_special_act_post_process
  from .utils import get_qparam_dict, has_no_children_ignoring_parametrizations
  from torch.ao.quantization.stubs import DeQuantStub, QuantWrapper
  from torch.ao.quantization.qconfig import _add_module_to_qconfig_obs_ctr, default_dynamic_qconfig, float16_dynamic_qconfig, float_qparams_weight_only_qconfig, float_qparams_weight_only_qconfig_4bit, _activation_is_memoryless
  from torch.nn.utils.parametrize import type_before_parametrizations
  from torch.ao.quantization.observer import _is_activation_post_process
  from torch.ao.quantization.observer import _is_activation_post_process
label_desc: Use image node_id 15 for calling a global function with example usage: prepare_qat(model, mapping, inplace) and returns: model