diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/common_methods_invocations.py | 5 | ||||
-rw-r--r-- | test/test_jit.py | 8 |
2 files changed, 6 insertions, 7 deletions
diff --git a/test/common_methods_invocations.py b/test/common_methods_invocations.py index 756bba9256..abb7856fde 100644 --- a/test/common_methods_invocations.py +++ b/test/common_methods_invocations.py @@ -2,6 +2,7 @@ import torch from torch._six import inf, nan, istuple from functools import reduce, wraps from operator import mul, itemgetter +import collections from torch.autograd import Variable, Function, detect_anomaly from torch.testing import make_non_contiguous from common_utils import (skipIfNoLapack, @@ -72,9 +73,7 @@ def prod_zeros(dim_size, dim_select): return result -class non_differentiable(object): - def __init__(self, tensor): - self.tensor = tensor +non_differentiable = collections.namedtuple('non_differentiable', ['tensor']) class dont_convert(tuple): diff --git a/test/test_jit.py b/test/test_jit.py index c4ab4e8202..0a194bc515 100644 --- a/test/test_jit.py +++ b/test/test_jit.py @@ -13942,7 +13942,7 @@ class TestClassType(JitTestCase): self.assertEqual(fn(input), input) def test_get_attr(self): - @torch.jit.script + @torch.jit.script # noqa: B903 class FooTest: def __init__(self, x): self.foo = x @@ -14005,7 +14005,7 @@ class TestClassType(JitTestCase): def test_type_annotations(self): with self.assertRaisesRegex(RuntimeError, "expected a value of type bool"): - @torch.jit.script + @torch.jit.script # noqa: B903 class FooTest: def __init__(self, x): # type: (bool) -> None @@ -14026,7 +14026,7 @@ class TestClassType(JitTestCase): self.attr = x def test_class_type_as_param(self): - @torch.jit.script + @torch.jit.script # noqa: B903 class FooTest: def __init__(self, x): self.attr = x @@ -14094,7 +14094,7 @@ class TestClassType(JitTestCase): self.assertEqual(input, output) def test_save_load_with_classes_nested(self): - @torch.jit.script + @torch.jit.script # noqa: B903 class FooNestedTest: def __init__(self, y): self.y = y |