Refactor functions in functorch for functional (#141808)

As the title stated
Pull Request resolved: https://github.com/pytorch/pytorch/pull/141808
Approved by: https://github.com/Skylion007
This commit is contained in:
FFFrog 2024-11-30 09:39:31 +08:00 committed by PyTorch MergeBot
parent 0f3f801fc2
commit 8a81f7a4b6

View file

@ -75,8 +75,7 @@ void _propagate_functional_input_mutation(
// It would probably be more reasonable to check that the two tensors are
// aliased, but we can't do that unless we give BatchedTensorImpl a notion of
// storage.
if (unwrapped.unsafeGetTensorImpl() == wrapped_inner.unsafeGetTensorImpl()) {
} else {
if (unwrapped.unsafeGetTensorImpl() != wrapped_inner.unsafeGetTensorImpl()) {
if (unwrapped.sym_nbytes() != wrapped_inner.sym_nbytes()) {
// Functions might resize zero-sized inputs, which we need to reflect
// ehre.