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: Validating if the config is valid.
  
  This includes asserting the following:
  1. validating that one and only one of top_k_element and top_k_percent is set.
  2. Asserting that both element and percentage are in valid ranges.
  
  Throws:
      ValueError:
          If validation fails.
docstr_tok: ["Validating","if","the","config","is","valid",".","This","includes","asserting","the","following",":","1.","validating","that","one","and","only","one","of","top_k_element","and","top_k_percent","is","set",".","2",".","Asserting","that","both","element","and","percentage","are","in","valid","ranges",".","Throws",":","ValueError",":","If","validation","fails","."]
code: def _validate_conf(self) -> None:
      """Validating if the config is valid.
  
      This includes asserting the following:
      1. validating that one and only one of top_k_element and top_k_percent is set.
      2. Asserting that both element and percentage are in valid ranges.
  
      Throws:
          ValueError:
              If validation fails.
      """
  
      # assert that both top_k_elements and top_k_percent aren't set for sst and dst
      def both_set(a: Optional[int], b: Optional[float]) -> bool:
          return (a is not None) and (b is not None)
  
      if both_set(
          self._sst_top_k_element, self._sst_top_k_percent
      ) or both_set(self._dst_top_k_element, self._dst_top_k_percent):
          raise ValueError(
              "top_k_element and top_k_percent can't be both set\n"
              f"Input values are: sst element={self._sst_top_k_element}, sst percent={self._sst_top_k_percent}, "
              f"dst element={self._dst_top_k_element}, dst percent={self._dst_top_k_percent}"
          )
  
      # assert that, if top_k_percent is not None, it is a valid number for a percentage.
      def none_or_in_range(a: Optional[float]) -> bool:
          return a is None or (0.0 < a <= 100.0)
  
      if not (
          none_or_in_range(self._sst_top_k_percent)
          and none_or_in_range(self._dst_top_k_percent)
      ):
          raise ValueError(
              "top_k_percent values for sst and dst has to be in the interval (0, 100].\n"
              f"Input values are: sst percent={self._sst_top_k_percent}, dst percent={self._dst_top_k_percent}"
          )
  
      def none_or_greater_0(a: Optional[int]) -> bool:
          return a is None or (0 < a)
  
      if not (
          none_or_greater_0(self._sst_top_k_element)
          and none_or_greater_0(self._dst_top_k_element)
      ):
          raise ValueError(
              "top_k_element values for sst and dst has to be greater than 0.\n"
              f"Input values are: sst element={self._sst_top_k_element} "
              f"and dst element={self._dst_top_k_element}"
          )
  
imports: from enum import Enum
  from typing import Optional, Tuple
  import torch
  from torch import Tensor
label_desc: Use image node_id 4 for calling the SignalSparsity obj's underlying member method code with example usage: obj._validate_conf() and returns: unknown, unknown, unknown