code: def test_sequential_network_config_for_symmetric(
      mnist_model_quantization,
  ):
      """
      Tests a sequential network with multiple modules is configured correctly.
      This network has layers where input and output observers are shared. We test
      that for these layers, we set activation quantizer correctly for always affine layers
      """
      data = torch.randn(1, 1, 28, 28)
      prepared_model, quantizer = quantize_model(
          mnist_model_quantization, data
      )
  
      # verify module fusion
      assert isinstance(prepared_model.conv1, _qat.ConvBnAct2d)
      assert isinstance(prepared_model.conv2, _qat.ConvAct2d)
      assert isinstance(prepared_model.dense1, _qat.LinearAct)
      assert isinstance(prepared_model.dense2, _qat.LinearAct)
  
      # verify activation quantizers
      # after input
      assert (
          prepared_model.activation_post_process_0.qscheme
          == torch.per_tensor_symmetric
      )
      # after conv1
      assert (
          prepared_model.activation_post_process_1.qscheme
          == torch.per_tensor_affine
      )
      # after pool, this is shared with output of conv1
      assert id(prepared_model.activation_post_process_1) == id(
          prepared_model.activation_post_process_2
      )
      # after conv2
      assert (
          prepared_model.activation_post_process_3.qscheme
          == torch.per_tensor_affine
      )
      # after pool and flatten, shared with output of conv2
      assert id(prepared_model.activation_post_process_3) == id(
          prepared_model.activation_post_process_4
      )
      assert id(prepared_model.activation_post_process_3) == id(
          prepared_model.activation_post_process_5
      )
      # after linear1
      assert (
          prepared_model.activation_post_process_6.qscheme
          == torch.per_tensor_affine
      )
      # after dropout
      # we remove activation post process after dropout layer
      assert not hasattr(prepared_model, "activation_post_process_7")
      # after linear2, logsoftmax
      assert (
          prepared_model.activation_post_process_8.qscheme
          == torch.per_tensor_symmetric
      )
  
      # convert model and test fusion
      converted_model = quantizer.finalize(inplace=False)
  
      # assert converted module fusion
      assert isinstance(
          converted_model.conv1, _quantized.QuantizedConvAct2d
      )
      assert isinstance(
          converted_model.conv2, _quantized.QuantizedConvAct2d
      )
      assert isinstance(
          converted_model.dense1, _quantized.QuantizedLinearAct
      )
      assert isinstance(
          converted_model.dense2, _quantized.QuantizedLinearAct
      )
  
imports: import operator
  from collections import OrderedDict
  from typing import List
  import pytest
  import torch
  import torch.ao.nn.quantized.reference
  import torch.ao.quantization
  import torch.nn
  import torch.nn.intrinsic
  import torch.nn.intrinsic.qat
  import torch.nn.qat
  import torch.nn.quantized
  from coremltools.optimize.torch.quantization import LinearQuantizer, LinearQuantizerConfig
  from coremltools.optimize.torch.quantization._backend_config import _mod_activations
  from coremltools.optimize.torch.quantization._qconfig_mapping import _QConfigMappingBuilder
  from coremltools.optimize.torch.quantization._utils import find_module, is_activation_post_process
  from coremltools.optimize.torch.quantization.modules import fused_modules
  from coremltools.optimize.torch.quantization.modules import qat_modules
  from coremltools.optimize.torch.quantization.modules import quantized_modules
  from coremltools.optimize.torch.quantization.quantization_config import QuantizationScheme
label_desc: Use image node_id 12 for calling a global function with example usage: test_sequential_network_config_for_symmetric(mnist_model_quantization) without return types