From ec4e34d6137397edbadef8f06185fc4f5b3b5d3e Mon Sep 17 00:00:00 2001 From: Huanyu Zhang Date: Tue, 25 Jun 2024 14:54:38 -0700 Subject: [PATCH] Fix the doctest due to numpy 2.0 (#654) Summary: Pull Request resolved: https://github.com/pytorch/opacus/pull/654 Doctest fails due to numpy's upgrade into 2.0, which changes the way of printing. https://github.com/astropy/astropy/issues/15095 Differential Revision: D58873298 --- opacus/accountants/analysis/rdp.py | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/opacus/accountants/analysis/rdp.py b/opacus/accountants/analysis/rdp.py index c83dc05f..0106cbee 100644 --- a/opacus/accountants/analysis/rdp.py +++ b/opacus/accountants/analysis/rdp.py @@ -39,7 +39,7 @@ ... rdp += compute_rdp(q=q, noise_multiplier=sigma, steps=steps, orders=orders) >>> epsilon, opt_order = get_privacy_spent(orders=orders, rdp=rdp, delta=1e-5) - >>> epsilon, opt_order # doctest: +NUMBER + >>> float(epsilon), int(opt_order) # doctest: +NUMBER (0.336, 23) """ diff --git a/requirements.txt b/requirements.txt index 7a591a56..a114129f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -numpy>=1.15 +numpy>=1.15,<2.0 torch>=2.0 scipy>=1.2 opt-einsum>=3.3.0