Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/torchaudio_unittest/sox_io_backend/load_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def assert_mp3(self, sample_rate, num_channels, bit_rate, duration):
data_ref = load_wav(ref_path)[0]
# 5. Compare
assert sr == sample_rate
self.assertEqual(data, data_ref, atol=3e-03, rtol=1.3e-06)
self.assertEqual(data, data_ref, atol=5e-05, rtol=1.3e-06)

def assert_flac(self, sample_rate, num_channels, compression_level, duration):
"""`sox_io_backend.load` can load flac format.
Expand Down
2 changes: 1 addition & 1 deletion torchaudio/csrc/sox/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ torch::Tensor convert_to_tensor(
// So make sure to create a new copy after processing samples.
if (normalize || dtype == torch::kFloat32) {
t = t.to(torch::kFloat32);
t *= (t > 0) / 2147483647. + (t < 0) / 2147483648.;
t.divide_(2147483648);
} else if (dtype == torch::kInt32) {
t = t.clone();
} else if (dtype == torch::kInt16) {
Expand Down