1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//! Type definitions for pruning schedules.
use ;
/// Pruning schedule defining when sparsity increases during training.
///
/// # Variants
///
/// - `OneShot`: All pruning happens at a single step
/// - `Gradual`: Linear interpolation between initial and final sparsity
/// - `Cubic`: Cubic polynomial schedule for smoother transitions
///
/// # Example
///
/// ```
/// use entrenar::prune::PruningSchedule;
///
/// // One-shot pruning at step 1000
/// let oneshot = PruningSchedule::OneShot { step: 1000 };
/// assert_eq!(oneshot.sparsity_at_step(500), 0.0);
/// assert_eq!(oneshot.sparsity_at_step(1000), 1.0);
///
/// // Gradual pruning from steps 100-1000
/// let gradual = PruningSchedule::Gradual {
/// start_step: 100,
/// end_step: 1000,
/// initial_sparsity: 0.0,
/// final_sparsity: 0.5,
/// frequency: 10,
/// };
/// assert_eq!(gradual.sparsity_at_step(50), 0.0);
/// assert_eq!(gradual.sparsity_at_step(1000), 0.5);
/// ```