Skip to content

Commit

Permalink
Remove debug statement
Browse files Browse the repository at this point in the history
  • Loading branch information
mthrok committed Jun 19, 2020
1 parent d1ca504 commit 4bf7016
Showing 1 changed file with 0 additions and 49 deletions.
49 changes: 0 additions & 49 deletions torchaudio/csrc/sox_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<scalar_t, 2>();
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(
Expand All @@ -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<int64_t>(sd->signal.rate),
static_cast<int64_t>(sd->signal.channels),
Expand Down Expand Up @@ -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_);
Expand All @@ -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) {
Expand Down

0 comments on commit 4bf7016

Please sign in to comment.