Commit c7e2eb50 authored by Alex Beloi's avatar Alex Beloi Committed by Facebook GitHub Bot
Browse files

[perf][5/5] Replace IValue::toString()->string() with IValue::toStringRef() (#2700)

Summary:
Pull Request resolved: https://github.com/pytorch/audio/pull/2700

ATT for pytorch/audio

Reviewed By: mthrok

Differential Revision: D39707243

fbshipit-source-id: 1dc2a5a9fe913a9071e6df679e39d632b75212fb
parent 7ba7cf4d
...@@ -34,6 +34,6 @@ int main(int argc, char* argv[]) { ...@@ -34,6 +34,6 @@ int main(int argc, char* argv[]) {
auto emission = encoder.forward({waveform}); auto emission = encoder.forward({waveform});
std::cout << "Generating the transcription" << std::endl; std::cout << "Generating the transcription" << std::endl;
auto result = decoder.forward({emission}); auto result = decoder.forward({emission});
std::cout << result.toString()->string() << std::endl; std::cout << result.toStringRef() << std::endl;
std::cout << "Done." << std::endl; std::cout << "Done." << std::endl;
} }
...@@ -57,7 +57,7 @@ int main(int argc, char* argv[]) { ...@@ -57,7 +57,7 @@ int main(int argc, char* argv[]) {
t_encode += std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0); t_encode += std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0);
t_decode += std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1); t_decode += std::chrono::duration_cast<std::chrono::milliseconds>(t2 - t1);
auto hypothesis = result.toString()->string(); auto hypothesis = result.toStringRef();
output_hyp << hypothesis << " (" << id << ")" << std::endl; output_hyp << hypothesis << " (" << id << ")" << std::endl;
output_ref << reference << " (" << id << ")" << std::endl; output_ref << reference << " (" << id << ")" << std::endl;
std::cout << id << '\t' << hypothesis << std::endl; std::cout << id << '\t' << hypothesis << std::endl;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment