[libtpu] Fix memory management bug in GetLibTpuInitArguments().

We save the raw pointers from 'args' into 'arg_ptrs' and return both vectors, so we should return 'std::move(args)' instead of making an implicit copy. I thought it would do this automatically but it empirically doesn't; I guess the std::pair screws up copy elision.

I also 'std::move(arg_ptrs)' for good measure, but I don't think this is necessary for correctness.

PiperOrigin-RevId: 360813200
Change-Id: Icfdf043883239d33777f2330f981a19b89c426ce
This commit is contained in:
Skye Wanderman-Milne 2021-03-03 19:29:25 -08:00 committed by TensorFlower Gardener
parent 596ba6778e
commit d36adfa164

View File

@ -87,7 +87,7 @@ GetLibTpuInitArguments() {
arg_ptrs.push_back(args[i].data());
}
return {args, arg_ptrs};
return {std::move(args), std::move(arg_ptrs)};
}
} // namespace tpu