Commit 3a58575
authored
Add call stack inspection to show warning only for deprecated to_edge workflow
Following the pattern from PR #13209 (XNNPACK), this commit:
1. Adds `import inspect` to enable call stack inspection
2. Adds `_check_if_called_from_to_backend()` helper method that:
- Returns False if called from to_edge_transform_and_lower (recommended flow)
- Returns True if called from to_backend in deprecated flow
3. Wraps the deprecation warning in a conditional check
This ensures the warning only appears when using the deprecated to_edge() + to_backend() workflow, not when using the recommended to_edge_transform_and_lower() flow.
Unit tests will be added in a separate commit.1 parent d99c31b commit 3a58575
1 file changed
+29
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
222 | 223 | | |
223 | 224 | | |
224 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
225 | 247 | | |
226 | 248 | | |
227 | 249 | | |
228 | 250 | | |
229 | | - | |
230 | | - | |
231 | | - | |
232 | | - | |
233 | | - | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
234 | 258 | | |
235 | 259 | | |
236 | 260 | | |
| |||
0 commit comments