Skip to content

Commit 2123db7

Browse files
hawkinspThe TensorFlow Datasets Authors
authored and
The TensorFlow Datasets Authors
committed
[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/devdocs/numpy_2_0_migration_guide.html). PiperOrigin-RevId: 656405338
1 parent 2f0e2f3 commit 2123db7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tensorflow_datasets/core/features/audio_feature_test.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ def _write_audio_file(np_audio, path, file_format):
247247
f'`{np_audio.dtype}`.'
248248
)
249249

250-
data = array.array(np.sctype2char(dtype), np_audio.reshape((-1,)))
250+
data = array.array(np.dtype(dtype).char, np_audio.reshape((-1,)))
251251
sample_width = np.dtype(dtype).alignment
252252
num_channels = np_audio.shape[1] if len(np_audio.shape) == 2 else 1
253253

tensorflow_datasets/image_classification/corruptions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ def plasma_fractal(mapsize=512, wibbledecay=3):
132132
"""
133133
if mapsize & (mapsize - 1) != 0:
134134
raise ValueError('mapsize must be a power of two.')
135-
maparray = np.empty((mapsize, mapsize), dtype=np.float_)
135+
maparray = np.empty((mapsize, mapsize), dtype=np.float64)
136136
maparray[0, 0] = 0
137137
stepsize = mapsize
138138
wibble = 100

0 commit comments

Comments
 (0)