Skip to content

Commit 8f60a93

Browse files
hawkinspcopybara-github
authored andcommitted
[numpy] Fix users of NumPy APIs that are removed in NumPy 2.0.
This change migrates users of APIs removed in NumPy 2.0 to their recommended replacements (https://numpy.org/doc/stable/numpy_2_0_migration_guide.html). This change replaces uses of `np.math`, which is a deprecated alias for the builtin `math` module, with the builtin `math` module. `np.math` is removed in NumPy 2.0. PiperOrigin-RevId: 658227973
1 parent 320e782 commit 8f60a93

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

tensorflow_graphics/rendering/opengl/tests/math_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def test_perspective_correct_interpolation_preset(self):
474474
camera_origin = np.array((0.0, 0.0, 0.0))
475475
camera_up = np.array((0.0, 1.0, 0.0))
476476
look_at_point = np.array((0.0, 0.0, 1.0))
477-
fov = np.array((90.0 * np.math.pi / 180.0,))
477+
fov = np.array((90.0 * math.pi / 180.0,))
478478
bottom_left = np.array((0.0, 0.0))
479479
image_size = np.array((501.0, 501.0))
480480
near_plane = np.array((0.01,))
@@ -616,7 +616,7 @@ def test_perspective_correct_barycentrics_preset(self):
616616
camera_origin = np.array((0.0, 0.0, 0.0))
617617
camera_up = np.array((0.0, 1.0, 0.0))
618618
look_at_point = np.array((0.0, 0.0, 1.0))
619-
fov = np.array((90.0 * np.math.pi / 180.0,))
619+
fov = np.array((90.0 * math.pi / 180.0,))
620620
bottom_left = np.array((0.0, 0.0))
621621
image_size = np.array((501.0, 501.0))
622622
near_plane = np.array((0.01,))

tensorflow_graphics/rendering/opengl/tests/rasterizer_op_test.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,13 @@
1717
from __future__ import division
1818
from __future__ import print_function
1919

20+
import math
21+
2022
from absl.testing import parameterized
2123
import numpy as np
2224
import six
2325
from six.moves import range
2426
import tensorflow as tf
25-
2627
from tensorflow_graphics.geometry.transformation import look_at
2728
from tensorflow_graphics.rendering.camera import perspective
2829
from tensorflow_graphics.rendering.opengl import rasterization_backend
@@ -122,7 +123,7 @@ def test_rasterize(self):
122123
camera_origin = (0.0, 0.0, 0.0)
123124
camera_up = (0.0, 1.0, 0.0)
124125
look_at_point = (0.0, 0.0, 1.0)
125-
fov = (60.0 * np.math.pi / 180,)
126+
fov = (60.0 * math.pi / 180,)
126127
near_plane = (1.0,)
127128
far_plane = (10.0,)
128129
batch_shape = tf.convert_to_tensor(

tensorflow_graphics/rendering/tests/rasterization_test_utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
# limitations under the License.
1414
"""Util functions for rasterization tests."""
1515

16+
import math
1617
import os
1718
import random
1819

1920
import numpy as np
2021
import tensorflow as tf
21-
2222
from tensorflow_graphics.geometry.transformation import look_at
2323
from tensorflow_graphics.rendering.camera import perspective
2424
from tensorflow_graphics.util import shape
@@ -39,7 +39,7 @@ def make_perspective_matrix(image_width=None, image_height=None):
3939
resulting image will be equal to the baseline image.
4040
"""
4141

42-
field_of_view = (40 * np.math.pi / 180,)
42+
field_of_view = (40 * math.pi / 180,)
4343
near_plane = (0.01,)
4444
far_plane = (10.0,)
4545
return perspective.right_handed(field_of_view,

0 commit comments

Comments
 (0)