Skip to content

Commit f442424

Browse files
committed
handle no channels case with non-object dtype
Signed-off-by: David Slater <[email protected]>
1 parent 1fd1f92 commit f442424

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

art/defences/preprocessor/mp3_compression.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,9 @@ def wav_to_mp3(x, sample_rate):
115115
x_mp3 = x_mp3 * 2 ** -15
116116
return x_mp3.astype(x_dtype)
117117

118+
if x.dtype != object and x.ndim == 2:
119+
x = x.astype(object)
120+
118121
if x.dtype != object and x.ndim != 3:
119122
raise ValueError("Mp3 compression can only be applied to temporal data across at least one channel.")
120123

0 commit comments

Comments
 (0)