class_docstr: A pruning schedule with constant sparsity throughout training.
  
  Sparsity is set to zero initially and to ``target_sparsity`` at
  step ``begin_step``.
  
  Args:
      begin_step (:obj:`int`): step at which to begin pruning.
class_docstr_tok: ["A","pruning","schedule","with","constant","sparsity","throughout","training",".","Sparsity","is","set","to","zero","initially","and","to","``","target_sparsity","``","at","step","``","begin_step","``",".","Args",":","begin_step","(",":","obj",":","`","int","`",")",":","step","at","which","to","begin","pruning","."]
code: def compute_sparsity(
      self,
      step_count: int,
      prev_sparsity: float,
      config: _ModuleOptimizationConfig,
  ) -> float:
      if step_count >= self.begin_step:
          assert hasattr(config, "target_sparsity"), (
              f"Attribute target_sparsity not found in config {config}. "
              f"{self.__class__} only works with configs "
              f"which have this attribute."
          )
          return config.target_sparsity
      return prev_sparsity
  
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 ConstantSparsityScheduler obj's underlying member method code with example usage: obj.compute_sparsity(step_count, prev_sparsity, config) and returns: prev_sparsity, config