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]])
| 71 | |
| 72 | |
| 73 | def 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 | |
| 84 | def eval_shape_upper_bound(shape: Iterable[Union[int, torch.SymInt]]) -> List[int]: |
no test coverage detected