(value: Value)
| 32 | |
| 33 | |
| 34 | def check_view_value(value: Value) -> bool: |
| 35 | # check if the value is a view tensor |
| 36 | if value.get_defining_op().name() in stride_ops: |
| 37 | # TODO(ooooo-create): The `x = stride_op(x)` shouldn't return True. |
| 38 | return True |
| 39 | all_used_ops = value.all_used_ops() |
| 40 | if len(all_used_ops) == 0: |
| 41 | return False |
| 42 | for op in all_used_ops: |
| 43 | if op.name() in stride_ops and op.operand_source(0).is_same(value): |
| 44 | # TODO(ooooo-create): The `y = stride_op(x).clone()` and `y = stride_op(x) + op` should also return False. |
| 45 | # Now is True. |
| 46 | return True |
| 47 | return False |
| 48 | |
| 49 | |
| 50 | # NOTE(pangyoki): The Inplace APIs with underline(`_`) is only valid for the method of calling `_C_ops` |
no test coverage detected