From 49455795ebd2dee11d6b14acc1dcd8dc36c678c7 Mon Sep 17 00:00:00 2001 From: generatedunixname89002005287564 Date: Sun, 20 Oct 2024 14:44:30 -0700 Subject: [PATCH] Remove default typing argument in PACKAGE file] [batch:20/511] [shard:5/N] Reviewed By: MaggieMoss Differential Revision: D64659584 fbshipit-source-id: 3dcc9da20b3f52d652928ce3ace39327b1a7fc83 --- tests/test_memoryview_stream.py | 1 - tests/test_snapshot.py | 1 - torchsnapshot/memoryview_stream.py | 4 ---- torchsnapshot/serialization.py | 5 ----- 4 files changed, 11 deletions(-) diff --git a/tests/test_memoryview_stream.py b/tests/test_memoryview_stream.py index 35d47e3..641b057 100644 --- a/tests/test_memoryview_stream.py +++ b/tests/test_memoryview_stream.py @@ -17,7 +17,6 @@ class MemoryviewStreamTest(unittest.TestCase): def test_memoryview_stream(self) -> None: tensor = torch.rand(1000) - # pyre-fixme[6]: For 1st argument expected `Buffer` but got `ndarray[Any, Any]`. mv = memoryview(tensor.numpy()).cast("b") self.assertEqual(len(mv), 4000) diff --git a/tests/test_snapshot.py b/tests/test_snapshot.py index 399fedc..40481ef 100644 --- a/tests/test_snapshot.py +++ b/tests/test_snapshot.py @@ -180,7 +180,6 @@ def test_app_state_with_primitive_types(tmp_path: Path) -> None: bytes_key=None, ) - # pyre-fixme[53]: Captured variable `snapshot` is not annotated. def _assert_primitive_entry_with_type( location_key: str, expected_type_name: str ) -> None: diff --git a/torchsnapshot/memoryview_stream.py b/torchsnapshot/memoryview_stream.py index d383e24..31f5716 100644 --- a/torchsnapshot/memoryview_stream.py +++ b/torchsnapshot/memoryview_stream.py @@ -13,13 +13,10 @@ # pyre-fixme[13]: Attribute `write` is never initialized. class MemoryviewStream(io.IOBase): - # pyre-fixme[24]: Generic type `memoryview` expects 1 type parameter. def __init__(self, mv: memoryview) -> None: - # pyre-fixme[24]: Generic type `memoryview` expects 1 type parameter. self._mv: memoryview = mv.cast("b") self._pos = 0 - # pyre-fixme[24]: Generic type `memoryview` expects 1 type parameter. def read(self, size: Optional[int] = -1) -> memoryview: if self.closed: raise ValueError("read from closed file") @@ -41,7 +38,6 @@ def read(self, size: Optional[int] = -1) -> memoryview: self._pos = newpos return b - # pyre-fixme[24]: Generic type `memoryview` expects 1 type parameter. def read1(self, size: int = -1) -> memoryview: """This is the same as read.""" return self.read(size) diff --git a/torchsnapshot/serialization.py b/torchsnapshot/serialization.py index f991466..836dea1 100644 --- a/torchsnapshot/serialization.py +++ b/torchsnapshot/serialization.py @@ -173,7 +173,6 @@ class Serializer(Enum): ] -# pyre-fixme[24]: Generic type `memoryview` expects 1 type parameter. def tensor_as_memoryview(tensor: torch.Tensor) -> memoryview: """ Obtain the class::`memoryview` of a class::`torch.Tensor`. @@ -200,11 +199,9 @@ def tensor_as_memoryview(tensor: torch.Tensor) -> memoryview: tensor = tensor.contiguous() if tensor.dtype == torch.bfloat16: return _tensor_as_memoryview_via_untyped_storage(tensor) - # pyre-fixme[6]: For 1st argument expected `Buffer` but got `ndarray[Any, Any]`. return memoryview(tensor.numpy()).cast("b") -# pyre-fixme[24]: Generic type `memoryview` expects 1 type parameter. def _tensor_as_memoryview_via_untyped_storage(tensor: torch.Tensor) -> memoryview: """ Obtain the class::`memoryview` of a class::`torch.Tensor` via untyped storage. @@ -226,7 +223,6 @@ def _tensor_as_memoryview_via_untyped_storage(tensor: torch.Tensor) -> memoryvie untyped_storage = contiguous_view_as_untyped_storage(tensor) tensor = torch.empty((0)) tensor.set_(untyped_storage) - # pyre-fixme[6]: For 1st argument expected `Buffer` but got `ndarray[Any, Any]`. return memoryview(tensor.numpy()).cast("b") @@ -253,7 +249,6 @@ def contiguous_view_as_untyped_storage(tensor: torch.Tensor) -> UntypedStorage: def tensor_from_memoryview( - # pyre-fixme[24]: Generic type `memoryview` expects 1 type parameter. mv: memoryview, dtype: torch.dtype, shape: List[int],