Commit d4ea20b
committed
[slimtensor] Add utility functions to common_shims_slim
Add utility functions to the header-only common_shims_slim library:
1. DType constants:
- `aoti_torch_dtype_float32()` - Returns 6 (ScalarType::Float)
- `aoti_torch_dtype_bfloat16()` - Returns 15 (ScalarType::BFloat16)
- `aoti_torch_dtype_int64()` - Returns 4 (ScalarType::Long)
- `aoti_torch_dtype_int32()` - Returns 3 (ScalarType::Int)
- `aoti_torch_dtype_int16()` - Returns 2 (ScalarType::Short)
- `aoti_torch_dtype_int8()` - Returns 1 (ScalarType::Char)
- `aoti_torch_dtype_bool()` - Returns 11 (ScalarType::Bool)
2. Device type constants:
- `aoti_torch_device_type_cpu()` - Returns 0 (DeviceType::CPU)
- `aoti_torch_device_type_cuda()` - Returns 1 (DeviceType::CUDA)
3. Grad mode functions (not supported in ExecuTorch):
- `aoti_torch_grad_mode_is_enabled()` - Always returns false
- `aoti_torch_grad_mode_set_enabled()` - Returns Ok for false, NotSupported for true
Differential Revision: [D90126250](https://our.internmc.facebook.com/intern/diff/D90126250/)
ghstack-source-id: 331923139
Pull Request resolved: #164571 parent 4f41a69 commit d4ea20b
File tree
2 files changed
+100
-0
lines changed- backends/aoti
- tests
2 files changed
+100
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
288 | 288 | | |
289 | 289 | | |
290 | 290 | | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
291 | 350 | | |
292 | 351 | | |
293 | 352 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
589 | 589 | | |
590 | 590 | | |
591 | 591 | | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
0 commit comments