Skip to content

Commit

Permalink
[export] Remove CallSpec (#117671)
Browse files Browse the repository at this point in the history
Summary: This is not really being used anywhere

Test Plan: CI

Differential Revision: D52842563

Pull Request resolved: #117671
Approved by: https://github.com/avikchaudhuri, https://github.com/zhxchen17
  • Loading branch information
angelayi authored and pytorchmergebot committed Feb 8, 2024
1 parent 9436710 commit c3e0836
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 14 deletions.
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

0 comments on commit c3e0836

Please sign in to comment.