MCPcopy Create free account
hub / github.com/pytorch/executorch / get_shape_env

Function get_shape_env

exir/program/_program.py:135–148  ·  view source on GitHub ↗
(gm)

Source from the content-addressed store, hash-verified

133
134def _get_updated_range_constraints(gm):
135 def get_shape_env(gm):
136 vals = [
137 node.meta["val"]
138 for node in gm.graph.nodes
139 if node.meta.get("val", None) is not None
140 ]
141 from torch._guards import detect_fake_mode # type: ignore[21]
142
143 fake_mode = detect_fake_mode(vals)
144 if fake_mode is not None:
145 return fake_mode.shape_env
146 for v in vals:
147 if isinstance(v, torch.SymInt):
148 return v.node.shape_env
149
150 shape_env = get_shape_env(gm)
151 if shape_env is None:

Callers 1

Calls 1

getMethod · 0.45

Tested by

no test coverage detected