code: def test_lossy_compress_sparsity_0(
      tensor, dim, top_k_percent, device
  ):
      """Tests whether lossy_compress method simply returns dense tensor when sparsity is 0."""
      if device == "cuda" and not torch.cuda.is_available():
          pytest.skip("no GPU")
  
      sparser = SignalSparsity(
          sst_top_k_percent=top_k_percent,
          sst_top_k_dim=dim,
          dst_top_k_percent=top_k_percent,
          dst_top_k_dim=dim,
      )
      lossy_dense, sst, dst = sparser.lossy_compress(tensor.to(device))
      objects_are_equal(
          lossy_dense.to(device),
          tensor.to(device),
          raise_exception=True,
          rtol=RTOL,
          atol=ATOL,
      )
      objects_are_equal(
          sst, None, raise_exception=True, rtol=RTOL, atol=ATOL
      )
      objects_are_equal(
          dst.to(device),
          tensor.to(device),
          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 11 for calling a global function with example usage: test_lossy_compress_sparsity_0(tensor, dim, top_k_percent, device) without return types