class_docstr: A pruning scheduler inspired by the paper `"To prune or not to prune" <https://arxiv.org/pdf/1710.01878.pdf>`_.
  
  It sets the sparsity at step :math:`t` using the formula:
  
  .. math::
  
          sparsity_t = target\_sparsity + (initial\_sparsity - target\_sparsity)
                     * (1 - \frac{update\_index}{total\_number\_of\_updates}) ^ {power}
  
  If :math:`t` is in :math:`update\_steps`, else it keeps the sparsity at its previous value.
  
  Here, :math:`update\_index` is the index of :math:`t` in the :math:`update\_steps` array and
  :math:`total\_number\_of\_updates` is the length of :math:`update\_steps` array.
  
  Args:
      update_steps (:obj:`list` of :obj:`int` or :obj:`str`): The indices of
          optimization steps at which pruning should be performed. This can
          be passed in as a string representing the range, such as
          ``range(start_index, end_index, step_size)``.
      power (:obj:`int`, optional): Exponent to be used in the
          sparsity function. Defaults to ``3``.
class_docstr_tok: ["A","pruning","scheduler","inspired","by","the","paper","`","``","To","prune","or","not","to","prune","''","<","https",":","\/\/arxiv.org\/pdf\/1710.01878.pdf",">","`","_",".","It","sets","the","sparsity","at","step",":","math",":","`","t","`","using","the","formula",":","..","math",":",":","sparsity_t","=","target\\_sparsity","+","(","initial\\_sparsity","-","target\\_sparsity",")","*","(","1","-","\\frac","{","update\\_index","}","{","total\\_number\\_of\\_updates","}",")","^","{","power","}","If",":","math",":","`","t","`","is","in",":","math",":","`","update\\_steps","`",",","else","it","keeps","the","sparsity","at","its","previous","value",".","Here",",",":","math",":","`","update\\_index","`","is","the","index","of",":","math",":","`","t","`","in","the",":","math",":","`","update\\_steps","`","array","and",":","math",":","`","total\\_number\\_of\\_updates","`","is","the","length","of",":","math",":","`","update\\_steps","`","array",".","Args",":","update_steps","(",":","obj",":","`","list","`","of",":","obj",":","`","int","`","or",":","obj",":","`","str","`",")",":","The","indices","of","optimization","steps","at","which","pruning","should","be","performed",".","This","can","be","passed","in","as","a","string","representing","the","range",",","such","as","``","range","(","start_index",",","end_index",",","step_size",")","``",".","power","(",":","obj",":","`","int","`",",","optional",")",":","Exponent","to","be","used","in","the","sparsity","function",".","Defaults","to","``","3","``","."]
code: def _check_update_steps(self, attribute, value):
      assert (
          len(value.size()) == 1
      ), f"update_steps: {value} must be a 1-D tensor or list of ints."
      for elem in value:
          if elem.int() != elem:
              raise ValueError(
                  f"Each element of update_steps {value} must be an integer."
              )
          assert (
              elem >= 0
          ), f"All elements of update_steps must be non-negative. Received: {value}."
  
imports: from abc import ABC
  from abc import abstractmethod
  from typing import Union
  import attr
  import torch
  from attr import define
  from attr import field
  from attrs import validators
  from coremltools.optimize.torch._utils.torch_utils import list_or_str_to_tensor
  from coremltools.optimize.torch.optimization_config import ModuleOptimizationConfig
  from coremltools.optimize.torch.pruning._utils import spline
label_desc: Use image node_id 1 for calling the PolynomialDecayScheduler obj's underlying member method code with example usage: obj._check_update_steps(attribute, value) without return types