class_docstr: All weights with absolute value smaller than ``threshold`` are changed to ``0``,
  and the tensor is stored in a sparse format.
  
  For example, given the following:
  
     * ``weight = [0.3, -0.2, -0.01, 0.05]``
     * ``threshold = 0.03``
  
  The sparsified weight would be ``[0.3, -0.2, 0, 0.05]``.
  
  Parameters
  ----------
  
  threshold: float
      All weight values above this threshold are set to ``0``.
  
      * Default value is ``1e-12``.
  
  minimum_sparsity_percentile: float
      The sparsity level must be above this value for the weight representation to be stored in the sparse format rather than the dense format.
  
      For example, if ``minimum_sparsity_percentile = 0.6`` and the sparisty level is ``0.54``; that is, ``54%`` of the
      weight values are exactly ``0``, then the resulting weight tensor will be stored as a dense const op,
      and not converted to the ``constsexpr_sparse_to_dense`` op (which stores the weight values in a sparse format).
  
      * Must be a value between ``0`` and ``1``.
      * Default value is ``0.5``.
  
  weight_threshold: int
      The size threshold, above which weights are pruned.
      That is, a weight tensor is pruned only if its total number of elements are greater than ``weight_threshold``.
  
      For example, if ``weight_threshold = 1024`` and a weight tensor is of shape ``[10, 20, 1, 1]``, hence ``200``
      elements, it will not be pruned.
  
      * If not provided, it will be set to ``2048``, in which weights bigger than ``2048`` elements are compressed.
class_docstr_tok: ["All","weights","with","absolute","value","smaller","than","``","threshold","``","are","changed","to","``","0","``",",","and","the","tensor","is","stored","in","a","sparse","format",".","For","example",",","given","the","following",":","*","``","weight","=","[","0.3",",","-0.2",",","-0.01",",","0.05","]","``","*","``","threshold","=","0.03","``","The","sparsified","weight","would","be","``","[","0.3",",","-0.2",",","0",",","0.05","]","``",".","Parameters","--","--","--","--","--","threshold",":","float","All","weight","values","above","this","threshold","are","set","to","``","0","``",".","*","Default","value","is","``","1e-12","``",".","minimum_sparsity_percentile",":","float","The","sparsity","level","must","be","above","this","value","for","the","weight","representation","to","be","stored","in","the","sparse","format","rather","than","the","dense","format",".","For","example",",","if","``","minimum_sparsity_percentile","=","0.6","``","and","the","sparisty","level","is","``","0.54","``",";","that","is",",","``","54","%","``","of","the","weight","values","are","exactly","``","0","``",",","then","the","resulting","weight","tensor","will","be","stored","as","a","dense","const","op",",","and","not","converted","to","the","``","constsexpr_sparse_to_dense","``","op","(","which","stores","the","weight","values","in","a","sparse","format",")",".","*","Must","be","a","value","between","``","0","``","and","``","1","``",".","*","Default","value","is","``","0.5","``",".","weight_threshold",":","int","The","size","threshold",",","above","which","weights","are","pruned",".","That","is",",","a","weight","tensor","is","pruned","only","if","its","total","number","of","elements","are","greater","than","``","weight_threshold","``",".","For","example",",","if","``","weight_threshold","=","1024","``","and","a","weight","tensor","is","of","shape","``","[","10",",","20",",","1",",","1","]","``",",","hence","``","200","``","elements",",","it","will","not","be","pruned",".","*","If","not","provided",",","it","will","be","set","to","``","2048","``",",","in","which","weights","bigger","than","``","2048","``","elements","are","compressed","."]
code: def check_threshold(self, attr, threshold):
      if threshold < 0:
          raise ValueError(
              f'Invalid value of "threshold": {threshold}. Needs to be in [0, inf)'
          )
  
imports: import sys
  from abc import ABC, abstractmethod
  from collections import OrderedDict
  from typing import IO, Any, Callable, Dict, Optional, Tuple, Union
  import cattrs
  import numpy
  import yaml
  from attrs import define, field, validators
  from coremltools.converters.mil.mil import Operation, types
  from coremltools.converters.mil.mil.types.type_mapping import is_builtin, numpy_type_to_builtin_type
label_desc: Use image node_id 1 for calling the OpThresholdPrunerConfig obj's underlying member method code with example usage: obj.check_threshold(attr, threshold) without return types