Repository navigation
Commit 2ace94d
authored
Accept Python buffer inputs (pytorch#23088) (pytorch#23088)
Summary:
## PR stack
1. **[pytorch#23088 — Accept Python
buffer inputs](pytorch#23088 ←
current
2. [pytorch#23089 — Remove ATen
dependency from portable
bindings](pytorch#23089)
3. [pytorch#23090 — Add zero-copy
DLPack interchange](pytorch#23090)
- accept NumPy arrays and other CPU objects implementing the Python
buffer protocol directly, without a new public tensor type
- alias dense buffer storage for execution and retain the exporter for
the full runtime input lifetime
- preserve shapes, strides, and dimension order, including channels-last
layouts
- treat a bare buffer as one input instead of iterating its first
dimension
- reject calls that mix buffer-backed and torch tensor inputs
- keep the existing torch output behavior in ATen-enabled builds
Test Plan:
- `cmake --build cmake-out-pr1 --target portable_lib -- -j4`
- focused tests for NumPy inputs, bare single-buffer dispatch,
mixed-protocol rejection, and non-dense views
- `python3 -m py_compile extension/pybindings/test/test_pybindings.py
extension/pybindings/pybindings.pyi`
- `git diff --check`
Authored with Codex.
Differential Revision: D123775944
Pulled By: JacobSzwejbka1 parent 4fe4d86 commit 2ace94d
7 files changed
Lines changed: 779 additions & 48 deletions
File tree
- extension/pybindings
- test
- runtime/core/exec_aten/util
- test
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
33 | 36 | | |
34 | 37 | | |
35 | 38 | | |
| |||
0 commit comments