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: Calculates DST from input dense and SST tensors.
  
  dense - inverse_transform(sst)[using sst_dst_to_dense method] -> top-k -> dst
  
  Args:
      dense (Tensor):
          Input dense tensor (no zeros).
      sst (Tensor):
          Input SST tensor (has zeros).
  
  Returns:
      (Tensor):
          Same shaped tensor, still dense format but has zeros. Non-zeros are top-k delta values.
docstr_tok: ["Calculates","DST","from","input","dense","and","SST","tensors",".","dense","-","inverse_transform","(","sst",")","[","using","sst_dst_to_dense","method","]","-",">","top-k","-",">","dst","Args",":","dense","(","Tensor",")",":","Input","dense","tensor","(","no","zeros",")",".","sst","(","Tensor",")",":","Input","SST","tensor","(","has","zeros",")",".","Returns",":","(","Tensor",")",":","Same","shaped","tensor",",","still","dense","format","but","has","zeros",".","Non-zeros","are","top-k","delta","values","."]
code: def dense_sst_to_dst(
      self, dense: Tensor, sst: Optional[Tensor]
  ) -> Optional[Tensor]:
      """Calculates DST from input dense and SST tensors.
  
      dense - inverse_transform(sst)[using sst_dst_to_dense method] -> top-k -> dst
  
      Args:
          dense (Tensor):
              Input dense tensor (no zeros).
          sst (Tensor):
              Input SST tensor (has zeros).
  
      Returns:
          (Tensor):
              Same shaped tensor, still dense format but has zeros. Non-zeros are top-k delta values.
      """
      if not self._dst_enabled:
          # Special case, DST is simply None, which represents an all-zero tensor.
          return None
  
      if sst is None:
          sst = torch.zeros_like(dense, dtype=torch.complex64)
  
      if not (dense.shape == sst.shape):
          raise ValueError("dense and sst have different shapes!")
  
      top_k_total_size = _top_k_total_size(dense, self._dst_top_k_dim)
      k = _get_k_for_topk(
          self._dst_top_k_percent,
          self._dst_top_k_element,
          top_k_total_size,
      )
      delta = dense - self.sst_dst_to_dense(
          sst
      )  # sst_dst_to_dense(sst) returns the inverse transform here
      del dense
      return _scatter_topk_to_sparse_tensor(
          delta.abs(), delta, k, dim=self._dst_top_k_dim
      )
  
imports: from enum import Enum
  from typing import Optional, Tuple
  import torch
  from torch import Tensor
label_desc: Use image node_id 6 for calling the SignalSparsity obj's underlying member method code with example usage: obj.dense_sst_to_dst(dense, sst) and returns: _scatter_topk_to_sparse_tensor, None