Don't allocate result Tensors in out overloads: Reduction Ops (#53218)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53218
We have some operators that previously allowed you to pass in an undefined tensor to the out argument,
and then would go on to allocate that for you. This behavior is broken and doesn't work in JIT when things
are converted to/from IValues. Because of this, it blocks backend fallbacks because they force going
through IValue.
This PR removes that behavior and forces out arguments to be defined tensors.
It only looks at reduction ops for now, there's likely more PRs coming for other ops.
BC Breaking: This breaks BC since those ops previously allowed calling with undefined tensors and that isn't allowed anymore.
ghstack-source-id: 125886980
(Note: this ignores all push blocking failures!)
Test Plan: waitforsandcastle
Reviewed By: ezyang
Differential Revision: D26795461
fbshipit-source-id: 158465260fe59deb7d4b2081e810a7434cfba722