Skip to content

Commit 0f1d260

Browse files
committed
fix: resolve ruff linter errors in multi_dtype_passes
- Add explicit re-export in __init__.py for DtypeConversionPass - Use TYPE_CHECKING for forward reference in pass_mgr.py - Remove unused torch import in autocast_wrapper_pass.py - Fix type annotation to use type[DtypeConversionPass]
1 parent 7971d41 commit 0f1d260

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
from graph_net.torch.multi_dtype_passes.pass_base import DtypeConversionPass
1+
from graph_net.torch.multi_dtype_passes.pass_base import (
2+
DtypeConversionPass as DtypeConversionPass,
3+
)

graph_net/torch/multi_dtype_passes/autocast_wrapper_pass.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
to handle operators that don't support low-precision computation natively.
66
"""
77

8-
import torch
98
import torch.fx as fx
9+
1010
from graph_net.torch.multi_dtype_passes.pass_base import DtypeConversionPass
1111

1212

graph_net/torch/multi_dtype_passes/pass_mgr.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,18 @@
22
Pass manager for dtype conversion passes.
33
"""
44

5-
from graph_net.imp_util import load_module
5+
from __future__ import annotations
6+
67
import os
8+
from typing import TYPE_CHECKING
9+
10+
from graph_net.imp_util import load_module
11+
12+
if TYPE_CHECKING:
13+
from graph_net.torch.multi_dtype_passes.pass_base import DtypeConversionPass
714

815

9-
def get_dtype_conversion_pass(pass_name: str) -> "DtypeConversionPass":
16+
def get_dtype_conversion_pass(pass_name: str) -> type[DtypeConversionPass]:
1017
"""
1118
Load a dtype conversion pass by name.
1219

0 commit comments

Comments
 (0)