Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/agent_audit/auditing/audit_primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,10 @@ def __exit__(self, exc_type, exc_val, exc_tb):
_active_auditor.reset(self._token)

def set_replay(self):
if not self.log:
raise ValueError("Cannot enter replay mode because no noise additions "
"were recorded. Make sure your noise functions are "
"annotated with @audit_spec.")
self.mode = AuditMode.REPLAY
self._cursor = 0

Expand Down Expand Up @@ -437,6 +441,10 @@ def _flatten_sample(sample):
)

def compute_overall_pld(self) -> pld.PrivacyLossDistribution:
if not self.log:
raise ValueError("Cannot compute privacy loss because no noise additions "
"were recorded. Make sure your noise functions are "
"annotated with @audit_spec.")
curr_pld = None
for entry in self.log:
entry_pld = (
Expand Down