class_docstr: Configuration class to store and validate threshold parameters.
  
  Args:
      threshold_type (ThresholdType or str): The type of threshold to apply.
          The possible values are:
  
              - :obj:`None`: No threshold is applied.
  
              - :obj:`"hard"`: A hard threshold is applied to each mask.
                The elements of the mask with a value below the :obj:`value`
                are set to :obj:`0`, the others are set to :obj:`1`.
  
              - :obj:`"topk"`: A soft threshold is applied to each mask.
                The top obj:`value` elements of each mask are kept, the
                others are set to :obj:`0`.
  
              - :obj:`"topk_hard"`: Same as :obj:`"topk"` but values are set
                to :obj:`1` for all elements which are kept.
  
      value (int or float, optional): The value to use when thresholding.
          (default: :obj:`None`)
code: def __init__(
      self,
      threshold_type: Union[ThresholdType, str],
      value: Union[float, int],
  ):
      self.type = ThresholdType(threshold_type)
      self.value = value
  
      if not isinstance(self.value, (int, float)):
          raise ValueError(
              f"Threshold value must be a float or int "
              f"(got {type(self.value)})."
          )
  
      if self.type == ThresholdType.hard and (
          self.value < 0 or self.value > 1
      ):
          raise ValueError(
              f"Threshold value must be between 0 and 1 "
              f"(got {self.value})"
          )
  
      if self.type in [ThresholdType.topk, ThresholdType.topk_hard]:
          if not isinstance(self.value, int):
              raise ValueError(
                  f"Threshold value needs to be an integer "
                  f"(got {type(self.value)})."
              )
          if self.value <= 0:
              raise ValueError(
                  f"Threshold value needs to be positive "
                  f"(got {self.value})."
              )
  
imports: from dataclasses import dataclass
  from enum import Enum
  from typing import Optional, Union
  from torch_geometric.utils.mixin import CastMixin
label_desc: Use image node_id 1 to create a new ThresholdConfig object from inherited base classes: CastMixin with example: obj = ThresholdConfig(threshold_type, value)