[pytorch/aten] Avoid temporary array reconstruction (#72391)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72391
Temporary array can be reused with in the loop, this will save memory reallocations and uninitialized_copy calls for the vector
Test Plan: CI
Reviewed By: jspark1105
Differential Revision: D34030993
fbshipit-source-id: 40708e3144c6c8f8ac3a6a45d668b34b5e52e095
(cherry picked from commit 859e126aef452eb33d7d466244a8f8c26d917eb8)