Skip to content

Commit 84b91ce

Browse files
bobrenjc93pytorchmergebot
authored andcommitted
remove allow-untyped-defs for torch/_inductor/test_operators.py (pytorch#143436)
Pull Request resolved: pytorch#143436 Approved by: https://github.com/aorenste
1 parent d8ea4ce commit 84b91ce

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

torch/_inductor/test_operators.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# mypy: allow-untyped-defs
1+
from typing import Any
2+
23
import torch.library
34
from torch import Tensor
45
from torch.autograd import Function
@@ -16,12 +17,13 @@
1617

1718
class Realize(Function):
1819
@staticmethod
19-
def forward(ctx, x):
20+
def forward(ctx: object, x: Tensor) -> Tensor:
2021
return torch.ops._inductor_test.realize(x)
2122

2223
@staticmethod
23-
def backward(ctx, grad_output):
24-
return grad_output
24+
# types need to stay consistent with _SingleLevelFunction
25+
def backward(ctx: Any, *grad_output: Any) -> Any:
26+
return grad_output[0]
2527

2628
def realize(x: Tensor) -> Tensor:
2729
return Realize.apply(x)

0 commit comments

Comments
 (0)