You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: add DFS-based ffi.ReprPrint for unified object repr (#454)
## Summary
- Single C++ `ffi.ReprPrint` function produces human-readable repr for
any TVM FFI value
- DFS with 3-state tracking (NotVisited/InProgress/Done):
- **DAGs**: memoized repr returned in full on every re-encounter
- **Cycles**: detected via InProgress state, shown as `...`
- Addresses hidden by default; set `TVM_FFI_REPR_WITH_ADDR=1` to show
- Per-field `Repr(false)` InfoTrait to exclude fields from repr output
- Built-in repr for String, Bytes, Tensor, Shape, Array, List, Map
- All Python `__repr__` methods delegate to this function
## Format Examples
```
42 # int
"hello" # String
(1, 2, 3) # Array
[1, 2, 3] # List
{"key": "value"} # Map
testing.MyObj(x=1, y="hi") # User object
... # Cycle marker
float32[3, 4]@cpu:0@0x1234 # Tensor
```
## Test plan
- [x] 55 Python tests covering primitives, containers, user objects,
DAGs, cycles, and `TVM_FFI_REPR_WITH_ADDR`
- [x] All pre-commit hooks pass (ruff, ty, clang-format, markdownlint,
etc.)
- [x] Container tests (`test_container.py`) pass with updated Array
format
0 commit comments