Skip to content

Commit c60d48b

Browse files
hawkinsptensorflow-copybara
authored andcommitted
[numpy] Replace np.reshape(x, newshape=y) with np.reshape(x, y).
The `newshape` argument to reshape is removed in NumPy 2.4. PiperOrigin-RevId: 840473550
1 parent ef4ba56 commit c60d48b

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

research/multi_representation_adversary/multi_representation_adversary/transforms_test.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,13 @@ def test_dct(self):
2828

2929
# Calculated by a reference implementation.
3030
expected = np.reshape(
31-
np.array([[1.5, 0.12247449, -0.21213203],
32-
[-0.12247449, -0.45, 0.25980762],
33-
[0.21213203, -0.4330127, -0.15]]),
34-
newshape=[1, 3, 3, 1])
31+
np.array([
32+
[1.5, 0.12247449, -0.21213203],
33+
[-0.12247449, -0.45, 0.25980762],
34+
[0.21213203, -0.4330127, -0.15],
35+
]),
36+
[1, 3, 3, 1],
37+
)
3538
self.assertAllClose(dct_x, expected)
3639

3740
def test_idct(self):
@@ -41,10 +44,13 @@ def test_idct(self):
4144

4245
# Calculated by a reference implementation.
4346
expected = np.reshape(
44-
np.array([[1.42522291, -0.04099682, 0.09735938],
45-
[-0.44310533, -0.39329966, 0.18787686],
46-
[0.39594028, -0.49707437, -0.13192325]]),
47-
newshape=[1, 3, 3, 1])
47+
np.array([
48+
[1.42522291, -0.04099682, 0.09735938],
49+
[-0.44310533, -0.39329966, 0.18787686],
50+
[0.39594028, -0.49707437, -0.13192325],
51+
]),
52+
[1, 3, 3, 1],
53+
)
4854
self.assertAllClose(idct_x, expected)
4955

5056
def test_inverse(self):

0 commit comments

Comments
 (0)