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][refactor][6/n] Remove equality_constraints #116979

Closed
wants to merge 1 commit into from
Closed
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
16 changes: 1 addition & 15 deletions torch/export/exported_program.py
@@ -1,4 +1,4 @@
import copy

Check warning on line 1 in torch/export/exported_program.py

View workflow job for this annotation

GitHub Actions / bc_linter

Function ExportedProgram.equality_constraints: function deleted

Check warning on line 1 in torch/export/exported_program.py

View workflow job for this annotation

GitHub Actions / bc_linter

Function ExportedProgram.equality_constraints: function deleted

Check warning on line 1 in torch/export/exported_program.py

View workflow job for this annotation

GitHub Actions / bc_linter

Function ExportedProgram.equality_constraints: function deleted
import dataclasses
import functools
import types
Expand Down Expand Up @@ -103,18 +103,12 @@
graph_signature: ExportGraphSignature,
state_dict: Dict[str, Union[torch.Tensor, torch.nn.Parameter]],
range_constraints: "Dict[sympy.Symbol, Any]",
equality_constraints: Optional[List[Tuple[Any, Any]]] = None,
module_call_graph: Optional[
List[ModuleCallEntry]
] = None, # TODO: make this not optional
module_call_graph: List[ModuleCallEntry],
example_inputs: Optional[Tuple[Tuple[Any, ...], Dict[str, Any]]] = None,
verifier: Optional[Type[Any]] = None, # TODO Change typing hint to Verifier.
tensor_constants: Optional[Dict[str, torch.Tensor]] = None,
):
from torch._export.exported_program import _create_graph_module_for_export
from torch._export.passes.add_runtime_assertions_for_constraints_pass import (
InputDim,
)

# Remove codegen related things from the graph. It should just be a flat graph.
graph._codegen = torch.fx.graph.CodeGen()
Expand All @@ -125,9 +119,6 @@
self._graph_signature: ExportGraphSignature = graph_signature
self._state_dict: Dict[str, Any] = state_dict
self._range_constraints: "Dict[sympy.Symbol, ValueRanges]" = range_constraints
self._equality_constraints: List[Tuple[InputDim, InputDim]] = (
equality_constraints or []
)
assert module_call_graph is not None
self._module_call_graph: List[ModuleCallEntry] = module_call_graph
self._example_inputs = example_inputs
Expand Down Expand Up @@ -202,11 +193,6 @@
def range_constraints(self):
return self._range_constraints

@property
@compatibility(is_backward_compatible=False)
def equality_constraints(self):
return self._equality_constraints

@property
@compatibility(is_backward_compatible=False)
def module_call_graph(self):
Expand Down