Skip to content

Commit caa39fc

Browse files
physicsrobclaude
andcommitted
graph/: import Node & friends from defining modules, not the package
The safe-autofix pass alphabetized graph/__init__.py, which exposed that sibling modules imported Node/Concatenate/LiteralValue from the package __init__ and relied on its hand-tuned import order. Import from the defining modules (graph.node, graph.misc) instead - order-independent and cycle-free. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 6ce52a6 commit caa39fc

8 files changed

Lines changed: 10 additions & 10 deletions

File tree

torchwright/graph/asserts.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,8 @@
4343

4444
import torch
4545

46-
from torchwright.graph import Concatenate, Node
47-
from torchwright.graph.misc import Check, Predicate
48-
from torchwright.graph.node import _current_annotation
46+
from torchwright.graph.misc import Check, Concatenate, Predicate
47+
from torchwright.graph.node import Node, _current_annotation
4948
from torchwright.graph.value_type import NodeValueType, Range, tightened_with
5049

5150

torchwright/graph/attn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import torch
22

3-
from torchwright.graph import Node
3+
from torchwright.graph.node import Node
44
from torchwright.graph.rope import ROPE_BASE, apply_rope, rope_cos_sin
55

66
# Causal mask sentinel: future positions are filled with this value before

torchwright/graph/embedding.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import torch
22

3-
from torchwright.graph import Node
3+
from torchwright.graph.node import Node
44
from torchwright.graph.spherical_codes import get_spherical_codes
55
from torchwright.graph.value_type import NodeValueType
66

torchwright/graph/ffn.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
import torch
2626

27-
from torchwright.graph import Node
27+
from torchwright.graph.node import Node
2828
from torchwright.graph.value_type import NodeValueType
2929

3030

torchwright/graph/linear.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import torch
22

3-
from torchwright.graph import Node
3+
from torchwright.graph.node import Node
44
from torchwright.graph.value_type import NodeValueType
55

66

torchwright/graph/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import torch
55

6-
from torchwright.graph import Node
6+
from torchwright.graph.node import Node
77
from torchwright.graph.value_type import NodeValueType
88

99
# A predicate maps a value tensor to ``(ok, detail)`` where ``detail`` is a

torchwright/graph/optimize.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@
99

1010
import torch
1111

12-
from torchwright.graph import Concatenate, LiteralValue, Node
1312
from torchwright.graph.ffn import FFN
1413
from torchwright.graph.linear import Linear
14+
from torchwright.graph.misc import Concatenate, LiteralValue
15+
from torchwright.graph.node import Node
1516

1617

1718
@dataclass

torchwright/graph/relu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import torch
22

3-
from torchwright.graph import Node
3+
from torchwright.graph.node import Node
44
from torchwright.graph.value_type import NodeValueType
55

66

0 commit comments

Comments
 (0)