Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FBcode->GH] [reland] rename DisableTorchFunction to DisableTorchFunctionSubclass (#88218) #7062

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions torchvision/prototype/datapoints/_datapoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import PIL.Image
import torch
from torch._C import DisableTorchFunction
from torch._C import DisableTorchFunctionSubclass
from torch.types import _device, _dtype, _size
from torchvision.transforms import InterpolationMode

Expand Down Expand Up @@ -87,7 +87,7 @@ def __torch_function__(
if not all(issubclass(cls, t) for t in types):
return NotImplemented

with DisableTorchFunction():
with DisableTorchFunctionSubclass():
output = func(*args, **kwargs or dict())

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

@property
def ndim(self) -> int: # type: ignore[override]
with DisableTorchFunction():
with DisableTorchFunctionSubclass():
return super().ndim

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

@property
def dtype(self) -> _dtype: # type: ignore[override]
with DisableTorchFunction():
with DisableTorchFunctionSubclass():
return super().dtype

def horizontal_flip(self) -> Datapoint:
Expand Down