Skip to content

Commit 4285eb3

Browse files
committed
NumPy 2.0 (commonly bundled with Python 3.11+) renamed the newshape parameter to shape in np.reshape(). Using positional arguments instead of keyword arguments works across all NumPy versions
1 parent 2616789 commit 4285eb3

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

traceml/tests/test_events_processing/test_event_values.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,8 @@ def test_prepare_video(self):
185185
video_before = np.random.random((4, 10, 3, 20, 20))
186186
video_after = prepare_video(np.copy(video_before))
187187
video_before = np.swapaxes(video_before, 0, 1)
188-
video_before = np.reshape(video_before, newshape=(10, -1))
189-
video_after = np.reshape(video_after, newshape=(10, -1))
188+
video_before = np.reshape(video_before, (10, -1))
189+
video_after = np.reshape(video_after, (10, -1))
190190
np.testing.assert_array_almost_equal(
191191
np.sum(video_before, axis=1), np.sum(video_after, axis=1)
192192
)

traceml/traceml/processors/events_processors/events_video_processors.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,6 @@ def is_power2(num):
123123
n_rows = 2 ** ((b.bit_length() - 1) // 2)
124124
n_cols = data.shape[0] // n_rows
125125

126-
data = np.reshape(data, newshape=(n_rows, n_cols, t, c, h, w))
126+
data = np.reshape(data, (n_rows, n_cols, t, c, h, w))
127127
data = np.transpose(data, axes=(2, 0, 4, 1, 5, 3))
128-
return np.reshape(data, newshape=(t, n_rows * h, n_cols * w, c))
128+
return np.reshape(data, (t, n_rows * h, n_cols * w, c))

0 commit comments

Comments
 (0)