Skip to content

Commit

Permalink
[FBcode->GH] [reland] rename DisableTorchFunction to DisableTorchFunc…
Browse files Browse the repository at this point in the history
…tionSubclass (#88218) (#7062)

[FBcode->GH]
https://www.internalfb.com/diff/D41268423

Co-authored-by: Samantha Andow <samdow@meta.com>
  • Loading branch information
pmeier and samdow authored Jan 5, 2023
1 parent 2fb9c49 commit 1353df9
Showing 1 changed file with 6 additions and 6 deletions.
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

0 comments on commit 1353df9

Please sign in to comment.