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/devdocs/numpy_2_0_migration_guide.html).

PiperOrigin-RevId: 656405338
  • Loading branch information
hawkinsp authored and The TensorFlow Datasets Authors committed Jul 26, 2024
1 parent 2f0e2f3 commit 2123db7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tensorflow_datasets/core/features/audio_feature_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ def _write_audio_file(np_audio, path, file_format):
f'`{np_audio.dtype}`.'
)

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

Expand Down
2 changes: 1 addition & 1 deletion tensorflow_datasets/image_classification/corruptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def plasma_fractal(mapsize=512, wibbledecay=3):
"""
if mapsize & (mapsize - 1) != 0:
raise ValueError('mapsize must be a power of two.')
maparray = np.empty((mapsize, mapsize), dtype=np.float_)
maparray = np.empty((mapsize, mapsize), dtype=np.float64)
maparray[0, 0] = 0
stepsize = mapsize
wibble = 100
Expand Down

0 comments on commit 2123db7

Please sign in to comment.