We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f442424 commit b3b9cb6Copy full SHA for b3b9cb6
art/defences/preprocessor/mp3_compression.py
@@ -115,6 +115,7 @@ def wav_to_mp3(x, sample_rate):
115
x_mp3 = x_mp3 * 2 ** -15
116
return x_mp3.astype(x_dtype)
117
118
+ x_orig_type = x.dtype
119
if x.dtype != object and x.ndim == 2:
120
x = x.astype(object)
121
@@ -149,6 +150,9 @@ def wav_to_mp3(x, sample_rate):
149
150
if x.dtype != object and self.channels_first:
151
x_mp3 = np.swapaxes(x_mp3, 1, 2)
152
153
+ if x_orig_type != object and x.dtype == object and x.ndim == 2:
154
+ x_mp3 = x_mp3.astype(x_orig_type)
155
+
156
return x_mp3, y
157
158
def _check_params(self) -> None:
0 commit comments