Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions torch/fx/experimental/symbolic_shapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,6 @@ def _create_fx_call_function(
fresh = False

if self._translation_validation_enabled and node_key not in self.fx_node_cache:
from torch.fx.experimental.validator import z3op

# Presence of None in the arguments implies that we should ignore this operation.
if any(a is None for a in args):
Expand All @@ -2208,12 +2207,11 @@ def _create_fx_call_function(
return None, fresh

fresh = True
lifted_op = z3op(op, self.validator)

# If translation validation is enabled, all arguments must have its
# own FX node.
assert all(a is not None for a in args), f"missing arg in FX graph ({op.__name__}): {args}"
node = self.fx_node_cache[node_key] = self.graph.call_function(lifted_op, args)
node = self.fx_node_cache[node_key] = self.graph.call_function(op, args)
self.name_to_node[node.name] = node

return self.fx_node_cache.get(node_key, None), fresh
Expand Down
5 changes: 2 additions & 3 deletions torch/fx/experimental/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -326,9 +326,8 @@ def placeholder(self, target: Target, args: Tuple[Argument, ...], kwargs: Dict[s

def call_function(self, target: Target, args: Tuple[Argument, ...], kwargs: Dict[str, Any]) -> Any:
if target != torch._assert:
# Actually runs the node target function (which is already
# lifted) with its arguments.
return super().call_function(target, args, kwargs)
# Lift and runs the node target function
return super().call_function(z3op(target, self.validator), args, kwargs) # type: ignore[arg-type]
# Adds the Z3 expression corresponding to the first argument
# as a validator input.
assert len(args) == 1, f"expected 1 argument on assertion. Got: {len(args)} "
Expand Down