Skip to content

Commit

Permalink
[numpy] Fix test failures under NumPy 2.2.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 704320367
  • Loading branch information
hawkinsp authored and tensorflower-gardener committed Dec 9, 2024
1 parent 95b2252 commit 7bb0662
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tensorflow_probability/python/math/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def trapz(
if dx is None:
dx = 1.
dx = tf.convert_to_tensor(dx, dtype=dtype, name='dx')
if ps.shape(dx):
if ps.shape(dx).size > 0:
raise ValueError('Expected dx to be a scalar, got dx={}'.format(dx))
elem_sum = tf.reduce_sum(y, axis=axis)
elem_sum -= 0.5 * tf.reduce_sum(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ def build_fixed_effects(num_steps,
else:
design_matrix = ps.ones([num_steps, 1], dtype=dtype)

if covariates:
if covariates is not None:
design_matrix = ps.concat(
[design_matrix] +
[tf.convert_to_tensor(x)[..., :num_steps, :] for x in covariates],
Expand Down

0 comments on commit 7bb0662

Please sign in to comment.