File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed
backends/xnnpack/operators Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1616 XNNStaticReshape ,
1717 XNode ,
1818)
19+
1920from executorch .backends .xnnpack .utils .utils import check_or_raise , get_input_node
21+ from torch .fx .experimental .symbolic_shapes import free_symbols
2022
2123
2224@register_node_visitor
@@ -57,7 +59,7 @@ def define_node(
5759
5860 num_dynamic_dims = 0
5961 for dim in dynamic_shape :
60- if isinstance (dim , torch . SymInt ):
62+ if free_symbols (dim ):
6163 num_dynamic_dims += 1
6264 new_shape .append (0 )
6365 else :
@@ -119,7 +121,7 @@ def define_node(
119121
120122 num_dynamic_dims = 0
121123 for dim in dynamic_shape :
122- if isinstance (dim , torch . SymInt ):
124+ if free_symbols (dim ):
123125 num_dynamic_dims += 1
124126 new_shape .append (0 )
125127 else :
Original file line number Diff line number Diff line change 2323
2424from executorch .exir .lowered_backend_module import create_submodule_from_nodes
2525from torch ._export .utils import is_buffer , is_lifted_tensor_constant , is_param
26+ from torch .fx .experimental .symbolic_shapes import has_free_symbols
2627from torch .fx .node import Node
2728from torch .fx .passes .utils .source_matcher_utils import SourcePartition
2829
@@ -424,10 +425,7 @@ def is_shape_dynamic(node: torch.fx.Node) -> bool:
424425 Check if the node shape is dynamic.
425426 """
426427
427- # Shape is dynamic if any of the dimensions don't evaluate to a static value
428- return "val" in node .meta and any (
429- isinstance (d , torch .SymInt ) for d in node .meta ["val" ].shape
430- )
428+ return has_free_symbols (node .meta ["val" ].shape )
431429
432430
433431# TODO - style: use templated types
You can’t perform that action at this time.
0 commit comments