diff options
| author | YurenHao0426 <Blackhao0426@gmail.com> | 2026-07-22 03:13:24 -0500 |
|---|---|---|
| committer | YurenHao0426 <Blackhao0426@gmail.com> | 2026-07-22 03:13:24 -0500 |
| commit | 1212a6319e69c89c5b71d38e126955d8e401f07e (patch) | |
| tree | 1939da91b724be066e35e5d767f49c398e7836f3 /experiments/protocol_smoke.py | |
| parent | d39da697bdef292b0a48e4fe1ccc93ed32187e06 (diff) | |
experiments: audit residual block usage with lesions
Diffstat (limited to 'experiments/protocol_smoke.py')
| -rw-r--r-- | experiments/protocol_smoke.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/experiments/protocol_smoke.py b/experiments/protocol_smoke.py index 339ac47..18de4c9 100644 --- a/experiments/protocol_smoke.py +++ b/experiments/protocol_smoke.py @@ -7,7 +7,8 @@ import torch sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from sdil.data import get_dataset_splits from sdil.core import SDILConfig, SDILNet -from experiments.run import calibration_work_per_event, fixed_training_probe +from experiments.run import (calibration_work_per_event, fixed_training_probe, + residual_lesion_report) def loader_labels(loader): @@ -65,11 +66,22 @@ def main(): } assert layerwise["batch_loss_evaluations"] == 9 assert abs(layerwise["forward_equivalent_batches"] - 11.0 / 3.0) < 1e-12 + + lesion_net = SDILNet([1, 4, 4, 4, 4, 2], act="relu", residual=True, device="cpu") + lesion_x = torch.linspace(0, 1, 16).view(-1, 1) + lesion_y = torch.zeros(16, dtype=torch.long) + lesion = residual_lesion_report( + lesion_net, [(lesion_x, lesion_y)], lesion_x[:8], fraction=1.0 / 3.0) + assert lesion["interior_layers"] == [1, 2, 3] + assert lesion["lesioned_layers"] == [3] + assert len(lesion["branch_to_skip_rms"]) == 3 + assert 0.0 <= lesion["lesion_eval_acc"] <= 1.0 print("validation split hash:", metadata["validation_index_sha256"]) print("train/validation/test: 59000/1000/10000; stratification exact") print("FashionMNIST recovery split: 55000/5000/10000; stratification exact") print("training-prefix diagnostic probe: deterministic; shuffle state unchanged") print("simultaneous/layerwise calibration cost accounting: exact") + print("final-third residual-block lesion: exact block selection and finite report") print("ALL PROTOCOL SMOKE CHECKS PASSED") |
