Skip to content

Commit

Permalink
remove allow-untyped-defs for torch/jit/_ir_utils.py (pytorch#143366)
Browse files Browse the repository at this point in the history
Pull Request resolved: pytorch#143366
Approved by: https://github.com/aorenste
  • Loading branch information
bobrenjc93 authored and pytorchmergebot committed Dec 17, 2024
1 parent bcd3692 commit e7ec923
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions torch/jit/_ir_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# mypy: allow-untyped-defs
from typing import Union

import torch
Expand All @@ -9,18 +8,20 @@ def __init__(
self,
insert_point_graph: torch._C.Graph,
insert_point: Union[torch._C.Node, torch._C.Block],
):
) -> None:
self.insert_point = insert_point
self.g = insert_point_graph
self.guard = None

def __enter__(self):
def __enter__(self) -> None:
self.prev_insert_point = self.g.insertPoint()
self.g.setInsertPoint(self.insert_point)

def __exit__(self, *args):
def __exit__(self, *args: object) -> None:
self.g.setInsertPoint(self.prev_insert_point)


def insert_point_guard(self, insert_point: Union[torch._C.Node, torch._C.Block]):
def insert_point_guard(
self: torch._C.Graph, insert_point: Union[torch._C.Node, torch._C.Block]
) -> _InsertPoint:
return _InsertPoint(self, insert_point)

0 comments on commit e7ec923

Please sign in to comment.