Skip to content

Commit 972e5a7

Browse files
samdowfacebook-github-bot
authored andcommitted
[reland] rename DisableTorchFunction to DisableTorchFunctionSubclass (#88218) (#89221)
Summary: X-link: pytorch/pytorch#89221 Pull Request resolved: #6958 First half of #87990. This doesn't change any of the behavior and is just a rename Reviewed By: zou3519 Differential Revision: D41268423 fbshipit-source-id: 44929eaac1aec2bd320697536f8cdc918643d6a9
1 parent 98f897c commit 972e5a7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

torchvision/prototype/datapoints/_datapoint.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import PIL.Image
77
import torch
8-
from torch._C import DisableTorchFunction
8+
from torch._C import DisableTorchFunctionSubclass
99
from torch.types import _device, _dtype, _size
1010
from torchvision.transforms import InterpolationMode
1111

@@ -87,7 +87,7 @@ def __torch_function__(
8787
if not all(issubclass(cls, t) for t in types):
8888
return NotImplemented
8989

90-
with DisableTorchFunction():
90+
with DisableTorchFunctionSubclass():
9191
output = func(*args, **kwargs or dict())
9292

9393
wrapper = cls._NO_WRAPPING_EXCEPTIONS.get(func)
@@ -129,22 +129,22 @@ def _F(self) -> ModuleType:
129129
# this way we return the result without passing into __torch_function__
130130
@property
131131
def shape(self) -> _size: # type: ignore[override]
132-
with DisableTorchFunction():
132+
with DisableTorchFunctionSubclass():
133133
return super().shape
134134

135135
@property
136136
def ndim(self) -> int: # type: ignore[override]
137-
with DisableTorchFunction():
137+
with DisableTorchFunctionSubclass():
138138
return super().ndim
139139

140140
@property
141141
def device(self, *args: Any, **kwargs: Any) -> _device: # type: ignore[override]
142-
with DisableTorchFunction():
142+
with DisableTorchFunctionSubclass():
143143
return super().device
144144

145145
@property
146146
def dtype(self) -> _dtype: # type: ignore[override]
147-
with DisableTorchFunction():
147+
with DisableTorchFunctionSubclass():
148148
return super().dtype
149149

150150
def horizontal_flip(self) -> Datapoint:

0 commit comments

Comments
 (0)