code: def test_dense_to_sst_perfect_recons(tensor, dim):
      """Tests the dense_to_sst method whether it simply performs an FFT transformation
      when top_k_percent is set at 100.
      """
      sparser_2d = SignalSparsity(
          sst_top_k_percent=100,
          sst_top_k_dim=dim,
          dst_top_k_percent=100,
      )
      if dim is None:
          fft_tensor = torch.fft.fft(tensor.flatten()).reshape(
              tensor.shape
          )
      else:
          fft_tensor = torch.fft.fft(tensor, dim=dim)
      assert all(
          (sparser_2d.dense_to_sst(tensor) == fft_tensor).flatten()
      )
  
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 4 for calling a global function with example usage: test_dense_to_sst_perfect_recons(tensor, dim) without return types