8000 [export] Remove CallSpec (#117671) · pytorch/pytorch@9a7d73d · GitHub
[go: up one dir, main page]

Skip to content

Commit 9a7d73d

Browse files
angelayifacebook-github-bot
authored andcommitted
[export] Remove CallSpec (#117671)
Summary: X-link: pytorch/executorch#1618 This is not really being used anywhere Test Plan: CI Reviewed By: zhxchen17 Differential Revision: D52842563
1 parent 6fe5a3a commit 9a7d73d

File tree

3 files changed

+2
-14
lines changed

3 files changed

+2
-14
lines changed

torch/_export/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@
7373
from torch.fx.graph import _PyTreeCodeGen, _PyTreeInfo
7474
from torch.utils._sympy.value_ranges import ValueRangeError, ValueRanges
7575

76-
from .exported_program import (
77-
CallSpec,
78-
)
7976
from .passes.add_runtime_assertions_for_constraints_pass import (
8077
_AddRuntimeAssertionsForInlineConstraintsPass,
8178
)

torch/_export/exported_program.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
import dataclasses
2-
from typing import Optional
31
import warnings
42

53

64
import torch
75
import torch.fx
8-
import torch.utils._pytree as pytree
96

107

118
# TODO(ycao): This is added to avoid breaking existing code temporarily.
@@ -32,13 +29,6 @@
3229
]
3330

3431

35-
# Information to maintain user calling/returning specs
36-
@dataclasses.dataclass
37-
class CallSpec:
38-
in_spec: Optional[pytree.TreeSpec]
39-
out_spec: Optional[pytree.TreeSpec]
40-
41-
4232
def _create_graph_module_for_export(root, graph):
4333
try:
4434
gm = torch.fx.GraphModule(root, graph)

torch/export/exported_program.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import functools
44
import types
55
import warnings
6+
from collections import namedtuple
67
from typing import (
78
Any,
89
Callable,
@@ -243,7 +244,7 @@ def example_inputs(self):
243244
@property
244245
@compatibility(is_backward_compatible=False)
245246
def call_spec(self):
246-
from torch._export.exported_program import CallSpec
247+
CallSpec = namedtuple("CallSpec", ["in_spec", "out_spec"])
247248

248249
if len(self.module_call_graph) == 0:
249250
return CallSpec(in_spec=None, out_spec=None)

0 commit comments

Comments
 (0)
0