class_docstr: This class represents a particular config for a set of signal
  processing based sparsification functions on tensors. This can
  be used both on weights, gradients and other tensors like the
  optimizer state.
  
  During initialization, this class requires a value for one of
  `sst_top_k_element` or `sst_top_k_percent` and also requires a
  value for one of `dst_top_k_element` or `dst_top_k_percent`.
  
  This class only handles tensor inputs and outputs. We leave
  state_dict type of data handling to upper layer functions.
  
  Args:
      algo (Algo):
          The algorithm used. Default: FFT
      sst_top_k_dim (int, optional):
          The dimension on which the top-k is done for SST.
          E.g. -1 is the last dim. None means flatten and top-k on all dims.
          There is no way to specify multiple dims other than None.
          Default: -1
      sst_top_k_element (int, optional):
          Number of top-k elements to retain for SST. Default: None
      sst_top_k_percent (float, optional):
          Percent of top-k elements to retain for SST. Default: None
      dst_top_k_dim (int, optional):
          The dimension on which the top-k is done for DST.
          E.g. -1 is the last dim. None means flatten and top-k on all dims.
          There is no way to specify multiple dims other than None.
          Default: None
      dst_top_k_element (int, optional):
          Number of top-k elements to retain for DST. Default: None
      dst_top_k_percent (float, optional):
          Percent of top-k elements to retain for DST. Default: None
  
  Example:
      .. code-block:: python
  
          2d_sparser = SignalSparsity(sst_top_k_element=10, dst_top_k_element=1)
          sst = 2d_sparser.dense_to_sst(linear.weight.data)
  
          3d_sparser = SingalSparsity(algo=Algo.FFT, sst_top_k_dim=None, dst_top_k_dim=-1, sst_top_k_percent=10, dst_top_k_element=100)
          conv.weight.data, _, _ = 3d_sparser.lossy_compress(conv.weight.data)
docstr: From dense tensor to lossy reconstruction of dense tensor with the help of SST and DST
  tensor calculation. If requested sparsity is zero (or top_100_percent) then simply returns
  the input dense tensor as the reconstruction.
  
  Args:
      dense (Tensor):
          Input dense tensor (no zeros).
  
  Returns:
      (Tuple[Tensor, Tensor, Tensor]):
          A tuple of the form (lossy_reconstruction, sst, dst) with three tensors of the same
          shape as the dense tensor.
docstr_tok: ["From","dense","tensor","to","lossy","reconstruction","of","dense","tensor","with","the","help","of","SST","and","DST","tensor","calculation",".","If","requested","sparsity","is","zero","(","or","top_100_percent",")","then","simply","returns","the","input","dense","tensor","as","the","reconstruction",".","Args",":","dense","(","Tensor",")",":","Input","dense","tensor","(","no","zeros",")",".","Returns",":","(","Tuple","[","Tensor",",","Tensor",",","Tensor","]",")",":","A","tuple","of","the","form","(","lossy_reconstruction",",","sst",",","dst",")","with","three","tensors","of","the","same","shape","as","the","dense","tensor","."]
code: def lossy_compress(
      self, dense: Tensor
  ) -> Tuple[Tensor, Optional[Tensor], Optional[Tensor]]:
      """From dense tensor to lossy reconstruction of dense tensor with the help of SST and DST
      tensor calculation. If requested sparsity is zero (or top_100_percent) then simply returns
      the input dense tensor as the reconstruction.
  
      Args:
          dense (Tensor):
              Input dense tensor (no zeros).
  
      Returns:
          (Tuple[Tensor, Tensor, Tensor]):
              A tuple of the form (lossy_reconstruction, sst, dst) with three tensors of the same
              shape as the dense tensor.
      """
  
      if _is_sparsity_zero(
          dense,
          self._sst_top_k_percent,
          self._sst_top_k_element,
          self._sst_top_k_dim,
      ) and _is_sparsity_zero(
          dense,
          self._dst_top_k_percent,
          self._dst_top_k_element,
          self._dst_top_k_dim,
      ):
          # when sparsity is 0% for both sst and dst, the dense tensor itself is returned as the reconstructed
          # tensor, sst is returned as None and dst as the dense tensor. This choice is made because with the
          # returned sst=None and dst=dense, we should be able to recombine them if needed to retrieve the
          # dense tensor again as: dense = inv_transform(sst) + dst, where inv_transform(sst=None) = zero_tensor
          # of the same size as dense.
          return dense, None, dense
      else:
          # depending on whether self._sst_enabled and self._dst_enabled, None SST/DST tensors can be returned
          # below as well.
          sst = self.dense_to_sst(dense)
          dst = self.dense_sst_to_dst(dense, sst)
          return self.sst_dst_to_dense(sst, dst), sst, dst
  
imports: from enum import Enum
  from typing import Optional, Tuple
  import torch
  from torch import Tensor
label_desc: Use image node_id 8 for calling the SignalSparsity obj's underlying member method code with example usage: obj.lossy_compress(dense) and returns: dense,  None,  dense, self,  sst,  dst