diff --git a/torchaudio/csrc/sox_io.cpp b/torchaudio/csrc/sox_io.cpp index f983073e775..8b6be1411f5 100644 --- a/torchaudio/csrc/sox_io.cpp +++ b/torchaudio/csrc/sox_io.cpp @@ -31,46 +31,6 @@ struct SoxDescriptor { sox_format_t* fd_; }; -void printHighPrecision(const torch::Tensor& t) { - AT_DISPATCH_ALL_TYPES(t.scalar_type(), "print", [&] { - auto acc = t.accessor(); - for (int i = 0; i < acc.size(0); i++) { - for (int j = 0; j < acc.size(1); j++) { - auto val = acc[i][j]; - std::cout << val << " "; - } - std::cout << std::endl; - } - }); -} - -void printEnds(const torch::Tensor& t) { - std::cout << "++ first 10" << std::endl; - printHighPrecision(t.index({Slice(None, 10, None)})); - std::cout << "++ last 10" << std::endl; - printHighPrecision(t.index({Slice(-10, None, None)})); -} - -void printSignalInfo(const sox_signalinfo_t signal) { - std::cout << " - rate: " << signal.rate << std::endl - << " - channels: " << signal.channels << std::endl - << " - precision: " << signal.precision << std::endl - << " - length: " << signal.length << std::endl; - if (signal.mult) { - std::cout << " - mult: " << *(signal.mult) << std::endl; - } -} - -void printEncodingInfo(const sox_encodinginfo_t encoding) { - std::cout << " - encoding: " << encoding.encoding << std::endl - << " - bits_per_sample: " << encoding.bits_per_sample << std::endl - << " - compression: " << encoding.compression << std::endl - << " - reverse_bytes: " << encoding.reverse_bytes << std::endl - << " - reverse_nibbles: " << encoding.reverse_nibbles << std::endl - << " - reverse_bits: " << encoding.reverse_bits << std::endl - << " - opposite_endian: " << encoding.opposite_endian << std::endl; -} - } // namespace c10::intrusive_ptr<::torchaudio::SignalInfo> get_info( @@ -85,9 +45,6 @@ c10::intrusive_ptr<::torchaudio::SignalInfo> get_info( throw std::runtime_error("Error opening audio file"); } - printSignalInfo(sd->signal); - printEncodingInfo(sd->encoding); - return c10::make_intrusive<::torchaudio::SignalInfo>( static_cast(sd->signal.rate), static_cast(sd->signal.channels), @@ -374,10 +331,6 @@ void save_audio_file( throw std::runtime_error("Error saving audio file: failed to open file."); } - std::cout << "++ Detected info: " << std::endl; - printSignalInfo(sd->signal); - printEncodingInfo(sd->encoding); - auto tensor_ = tensor; // std::cout << "++ tensor before normalization" << std::endl; // printEnds(tensor_); @@ -398,8 +351,6 @@ void save_audio_file( tensor_ -= 128; tensor_ *= 16777216; } - // std::cout << "++ tensor after nomalization" << std::endl; - // printEnds(tensor_); // Format & clean up if (channel_first) {