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

Function eval_shape

exir/sym_util.py:73–81  ·  view source on GitHub ↗

Shape maybe immutable so we return a new shape. Return None for dimensions that are unbacked e.g. first dimension of nonzero's output.

(shape: Iterable[Union[int, torch.SymInt]])

Source from the content-addressed store, hash-verified

71
72
73def eval_shape(shape: Iterable[Union[int, torch.SymInt]]): # pyre-ignore[3]
74 """
75 Shape maybe immutable so we return a new shape. Return None for
76 dimensions that are unbacked e.g. first dimension of nonzero's output.
77 """
78 new_shape = []
79 for _, s in enumerate(shape):
80 new_shape.append(eval_expr(s))
81 return new_shape
82
83
84def eval_shape_upper_bound(shape: Iterable[Union[int, torch.SymInt]]) -> List[int]:

Callers 12

allocFunction · 0.90
callMethod · 0.90
get_shapeFunction · 0.90
define_nodeMethod · 0.90
define_tensor_listMethod · 0.90
define_nodeMethod · 0.90
define_nodeMethod · 0.90
define_nodeMethod · 0.90
_preprocess_tensorMethod · 0.90
mark_as_transformedMethod · 0.90
insert_nodeMethod · 0.90

Calls 2

eval_exprFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected