Skip to content

Commit a2ae355

Browse files
hawkinsptensorflower-gardener
authored andcommitted
[numpy] Replace references to np.trapz with np.trapezoid.
np.trapz is removed in NumPy 2.4. PiperOrigin-RevId: 840475664
1 parent 0dd71c2 commit a2ae355

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tensorflow_probability/python/experimental/distributions/importance_resample_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ def test_log_prob_independence_per_x(self):
275275
xs = np.linspace(0, 1.6, 100)
276276
aucs = []
277277
for s in samplers.split_seed(seed, n=30):
278-
aucs.append(np.trapz(
278+
aucs.append(np.trapezoid(
279279
self.evaluate(dist.prob(xs, seed=s, sample_size=100)), xs))
280280

281281
self.assertAllClose(aucs, np.ones_like(aucs), atol=.05)

tensorflow_probability/python/math/integration_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def test_against_numpy(self, data):
169169
x = data.draw(
170170
tfp_hps.constrained_tensors(tfp_hps.identity_fn, shp, dtype))
171171
dx = None
172-
np_soln = np.trapz(
172+
np_soln = np.trapezoid(
173173
self.evaluate(y),
174174
x=self.evaluate(x) if x is not None else None, # cannot evaluate(None)
175175
dx=dx or 1.0, # numpy default is 1.0

0 commit comments

Comments
 (0)