Use move to avoid copying (#17188)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/17188
Using flag "-Wreturn-std-move", compiler can identify the cases where a copy
operation
is performed when a move operation would have been available. Wrapped return
statement with std::move to fix.
For some reason, these files are not automatically modded. With D14115372
we should be able to turn on the compile flag
Reviewed By: soumith
Differential Revision: D14115786
fbshipit-source-id: e763b92eecbe4468027fc141d029618d1e9f280b