code: def test_sparse_qlinear(self):
      # Note: At the moment, for sparse kernels
      # fbgemm supports only static quantized sparse linear
      # qnnpack supports only dynamically quantized sparse linear
      # Hence we have two different tests.
      # fbgemm tests static flow, qnnpack tests dynamic.
      # Should be unified later on and tests should be fixed
      # appropriately.
      model_class = SparseQuantizedModel
      fqn_to_check = "linear"
      if qengine_is_fbgemm():
          sparse_mapping = (
              tq.get_default_static_sparse_quant_module_mappings()
          )
          ref_mapping = tq.get_default_static_quant_module_mappings()
          qconfig_dict = {nn.Linear: tq.get_default_qconfig("fbgemm")}
      elif qengine_is_qnnpack():
          sparse_mapping = (
              tq.get_default_dynamic_sparse_quant_module_mappings()
          )
          ref_mapping = tq.get_default_dynamic_quant_module_mappings()
          qconfig_dict = {nn.Linear: tq.qconfig.default_dynamic_qconfig}
      else:
          return
  
      _sparse_layer_test_helper(
          model_class=model_class,
          sparse_mapping=sparse_mapping,
          ref_mapping=ref_mapping,
          qconfig_dict=qconfig_dict,
          fqn_to_check=fqn_to_check,
          test_class=self,
          test_scripting=False,
      )
  
imports: from torch.testing._internal.common_utils import run_tests
  import copy
  import numpy
  import io
  import logging
  from itertools import product
  import torch
  import torch.ao.quantization
  from torch import nn
  from torch.ao.pruning.sparsifier.utils import fqn_to_module
  from torch.testing._internal.common_utils import TestCase, skipIfTorchDynamo
  from torch.testing._internal.common_quantized import override_cpu_allocator_for_qnnpack, override_qengines, qengine_is_qnnpack, qengine_is_fbgemm, qengine_is_onednn, qengine_is_x86
label_desc: Use image node_id 1 for calling the TestQuantizedSparseLayers obj's underlying member method code with example usage: obj.test_sparse_qlinear() without return types