Skip to content

Commit

Permalink
[numpy] Fix users of NumPy APIs that are removed in NumPy 2.0.
Browse files Browse the repository at this point in the history
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
  • Loading branch information
hawkinsp authored and copybara-github committed Aug 1, 2024
1 parent 320e782 commit 8f60a93
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tensorflow_graphics/rendering/opengl/tests/math_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ def test_perspective_correct_interpolation_preset(self):
camera_origin = np.array((0.0, 0.0, 0.0))
camera_up = np.array((0.0, 1.0, 0.0))
look_at_point = np.array((0.0, 0.0, 1.0))
fov = np.array((90.0 * np.math.pi / 180.0,))
fov = np.array((90.0 * math.pi / 180.0,))
bottom_left = np.array((0.0, 0.0))
image_size = np.array((501.0, 501.0))
near_plane = np.array((0.01,))
Expand Down Expand Up @@ -616,7 +616,7 @@ def test_perspective_correct_barycentrics_preset(self):
camera_origin = np.array((0.0, 0.0, 0.0))
camera_up = np.array((0.0, 1.0, 0.0))
look_at_point = np.array((0.0, 0.0, 1.0))
fov = np.array((90.0 * np.math.pi / 180.0,))
fov = np.array((90.0 * math.pi / 180.0,))
bottom_left = np.array((0.0, 0.0))
image_size = np.array((501.0, 501.0))
near_plane = np.array((0.01,))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
from __future__ import division
from __future__ import print_function

import math

from absl.testing import parameterized
import numpy as np
import six
from six.moves import range
import tensorflow as tf

from tensorflow_graphics.geometry.transformation import look_at
from tensorflow_graphics.rendering.camera import perspective
from tensorflow_graphics.rendering.opengl import rasterization_backend
Expand Down Expand Up @@ -122,7 +123,7 @@ def test_rasterize(self):
camera_origin = (0.0, 0.0, 0.0)
camera_up = (0.0, 1.0, 0.0)
look_at_point = (0.0, 0.0, 1.0)
fov = (60.0 * np.math.pi / 180,)
fov = (60.0 * math.pi / 180,)
near_plane = (1.0,)
far_plane = (10.0,)
batch_shape = tf.convert_to_tensor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
# limitations under the License.
"""Util functions for rasterization tests."""

import math
import os
import random

import numpy as np
import tensorflow as tf

from tensorflow_graphics.geometry.transformation import look_at
from tensorflow_graphics.rendering.camera import perspective
from tensorflow_graphics.util import shape
Expand All @@ -39,7 +39,7 @@ def make_perspective_matrix(image_width=None, image_height=None):
resulting image will be equal to the baseline image.
"""

field_of_view = (40 * np.math.pi / 180,)
field_of_view = (40 * math.pi / 180,)
near_plane = (0.01,)
far_plane = (10.0,)
return perspective.right_handed(field_of_view,
Expand Down

0 comments on commit 8f60a93

Please sign in to comment.