Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[export] Remove CallSpec #117671

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 0 additions & 3 deletions torch/_export/__init__.py
Expand Up @@ -73,9 +73,6 @@
from torch.fx.graph import _PyTreeCodeGen, _PyTreeInfo
from torch.utils._sympy.value_ranges import ValueRangeError, ValueRanges

from .exported_program import (
CallSpec,
)
from .passes.add_runtime_assertions_for_constraints_pass import (
_AddRuntimeAssertionsForInlineConstraintsPass,
)
Expand Down
10 changes: 0 additions & 10 deletions torch/_export/exported_program.py
@@ -1,11 +1,8 @@
import dataclasses
from typing import Optional
import warnings


import torch
import torch.fx
import torch.utils._pytree as pytree


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


# Information to maintain user calling/returning specs
@dataclasses.dataclass
class CallSpec:
in_spec: Optional[pytree.TreeSpec]
out_spec: Optional[pytree.TreeSpec]


def _create_graph_module_for_export(root, graph):
try:
gm = torch.fx.GraphModule(root, graph)
Expand Down
3 changes: 2 additions & 1 deletion torch/export/exported_program.py
Expand Up @@ -3,6 +3,7 @@
import functools
import types
import warnings
from collections import namedtuple
from typing import (
Any,
Callable,
Expand Down Expand Up @@ -243,7 +244,7 @@ def example_inputs(self):
@property
@compatibility(is_backward_compatible=False)
def call_spec(self):
from torch._export.exported_program import CallSpec
CallSpec = namedtuple("CallSpec", ["in_spec", "out_spec"])

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