use absl::make_unique instead of new

This commit is contained in:
Koan-Sin Tan 2019-06-25 09:08:17 +08:00
parent bdc5846c58
commit d300f261d6
2 changed files with 4 additions and 3 deletions

View File

@ -32,6 +32,7 @@ cc_binary(
"//tensorflow/lite:string_util",
"//tensorflow/lite/kernels:builtin_ops",
"//tensorflow/lite/profiling:profiler",
"@com_google_absl//absl/memory",
],
)

View File

@ -32,6 +32,7 @@ limitations under the License.
#include <unordered_set>
#include <vector>
#include "absl/memory/memory.h"
#include "tensorflow/lite/examples/label_image/bitmap_helpers.h"
#include "tensorflow/lite/examples/label_image/get_top_n.h"
#include "tensorflow/lite/kernels/register.h"
@ -184,9 +185,8 @@ void RunInference(Settings* s) {
exit(-1);
}
profiling::Profiler* profiler =
new profiling::Profiler(s->max_profiling_buffer_entries);
interpreter->SetProfiler(profiler);
auto profiler = absl::make_unique<profiling::Profiler>(s->max_profiling_buffer_entries);
interpreter->SetProfiler(profiler.get());
if (s->profiling) profiler->StartProfiling();