docstr: Helper function to check if the model, defaults and sparse_config are loaded correctly
  in the activation sparsifier
docstr_tok: ["Helper","function","to","check","if","the","model",",","defaults","and","sparse_config","are","loaded","correctly","in","the","activation","sparsifier"]
code: def _check_constructor(
      self, activation_sparsifier, model, defaults, sparse_config
  ):
      """Helper function to check if the model, defaults and sparse_config are loaded correctly
      in the activation sparsifier
      """
      sparsifier_defaults = activation_sparsifier.defaults
      combined_defaults = {**defaults, "sparse_config": sparse_config}
  
      # more keys are populated in activation sparsifier (eventhough they may be None)
      assert len(combined_defaults) <= len(
          activation_sparsifier.defaults
      )
  
      for key, config in sparsifier_defaults.items():
          # all the keys in combined_defaults should be present in sparsifier defaults
          assert config == combined_defaults.get(key, None)
  
imports: import copy
  from torch.testing._internal.common_utils import TestCase, skipIfTorchDynamo
  import logging
  import torch
  from torch.ao.pruning._experimental.activation_sparsifier.activation_sparsifier import ActivationSparsifier
  import torch.nn
  import torch.nn.functional
  from torch.ao.pruning.sparsifier.utils import module_to_fqn
  from typing import List
label_desc: Use image node_id 1 for calling the TestActivationSparsifier obj's underlying member method code with example usage: obj._check_constructor(activation_sparsifier, model, defaults, sparse_config) without return types