code: def test_sst_dst_to_perfect_dense_reconstruction(dense, k, dim):
      """Tests whether perfect reconstruction of input dense tensor is generated when top-k matches the numel
      across some dimension dim for both SST and DST.
      """
      sparser = SignalSparsity(
          sst_top_k_element=k,
          sst_top_k_dim=dim,
          dst_top_k_element=k,
          dst_top_k_dim=dim,
      )
      sst = sparser.dense_to_sst(dense)
      dst = sparser.dense_sst_to_dst(dense, sst)
      dense_recons = sparser.sst_dst_to_dense(sst, dst)
      objects_are_equal(
          dense,
          dense_recons,
          raise_exception=True,
          rtol=RTOL,
          atol=ATOL,
      )
  
file_path: fairscale/tests/experimental/wgit/test_signal_sparsity.py
imports: import pytest
  import torch
  from fairscale.experimental.wgit.signal_sparsity import SignalSparsity, random_sparse_mask
  from fairscale.fair_dev.testing.testing import objects_are_equal
label_desc: Use image node_id 1 for calling a global function with example usage: test_sst_dst_to_perfect_dense_reconstruction(dense, k, dim) without return types