only compare attributes for meta tensors (#72508)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/72508

Todo:

- [x] document this behavior
- [x] add tests

Test Plan: Imported from OSS

Reviewed By: zou3519

Differential Revision: D34262452

Pulled By: ezyang

fbshipit-source-id: bc5c9653d5c3ad5c6efccc9c8e0efc0d28e15104
(cherry picked from commit 233142c88e4cff02825c7e233aba9411a6df3e9f)
This commit is contained in:
Philip Meier
2022-02-16 18:25:35 -08:00
committed by PyTorch MergeBot
parent b5f2574f36
commit 1f74e082e2
9 changed files with 252 additions and 211 deletions

View File

@ -8,7 +8,7 @@ from operator import methodcaller
import torch
from torch.testing._internal.common_device_type import (
instantiate_device_type_tests, onlyCUDA, toleranceOverride, tol)
instantiate_device_type_tests, onlyCUDA, toleranceOverride, tol, skipMeta)
from torch.testing._internal.common_modules import module_db, modules
from torch.testing._internal.common_utils import (
TestCase, run_tests, freeze_rng_state, mock_wrapper, get_tensors_from, gradcheck, gradgradcheck)
@ -233,6 +233,7 @@ class TestModule(TestCase):
@modules([module_info for module_info in module_db
if 'inplace' in signature(module_info.module_cls).parameters])
@skipMeta
def test_check_inplace(self, device, dtype, module_info):
# Check if the inplace variant of the module gives the same result as the out of place
# variant.