code: def test_mask_squash_with_params1(self):
      model = SimpleLinear()
      sparsifier = ImplementedSparsifier(foo=3, bar=2, baz=1)
      sparsifier.prepare(
          model,
          [
              {"tensor_fqn": "linear1.weight"},
              {"tensor_fqn": "seq.0.weight"},
          ],
      )
      sparsifier.squash_mask(
          params_to_keep_per_layer={
              "linear1": ("foo", "bar"),
              "seq.0": ("baz",),
          }
      )
      assert not is_parametrized(model.seq[0], "weight")
      assert not is_parametrized(model.linear1, "weight")
      assert hasattr(model.seq[0], "sparse_params")
      assert hasattr(model.linear1, "sparse_params")
      assert model.seq[0].sparse_params.get("foo", None) is None
      assert model.seq[0].sparse_params.get("bar", None) is None
      assert model.seq[0].sparse_params.get("baz", None) == 1
      assert model.linear1.sparse_params.get("foo", None) == 3
      assert model.linear1.sparse_params.get("bar", None) == 2
      assert model.linear1.sparse_params.get("baz", None) is None
  
imports: import itertools
  import logging
  import re
  import torch
  from torch import nn
  from torch.ao.pruning import BaseSparsifier, WeightNormSparsifier, FakeSparsity, NearlyDiagonalSparsifier
  from torch.nn.utils.parametrize import is_parametrized
  from torch.testing._internal.common_utils import TestCase
  from torch.testing._internal.common_pruning import SimpleLinear, MockSparseLinear, ImplementedSparsifier
label_desc: Use image node_id 7 for calling the TestBaseSparsifier obj's underlying member method code with example usage: obj.test_mask_squash_with_params1() without return types