mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
19da3da3d3
The fix-cpp-build branch is a major restructuring that: - Drops Exhale (which auto-generated API docs but caused OOM in CI) in favor of hand-written RST pages using Breathe directives - Reorganizes notes into a hierarchical API reference with proper categories - Adds new content: XPU docs, stable ABI docs, DeviceGuard/Stream docs - Always runs Doxygen instead of gating on an env var Pull Request resolved: https://github.com/pytorch/pytorch/pull/174096 Approved by: https://github.com/janeyx99, https://github.com/seemethere, https://github.com/albanD
3.8 KiB
3.8 KiB
myst
| myst | ||||||
|---|---|---|---|---|---|---|
|
Stable Operators
The stable API provides tensor operations that maintain binary compatibility across PyTorch versions.
Tensor Class
:members:
:undoc-members:
Example:
torch::stable::Tensor tensor = torch::stable::empty({3, 4}, ...);
float* data = tensor.data_ptr<float>();
auto shape = tensor.sizes();
Device Class
:members:
:undoc-members:
Example:
torch::stable::Device cpu_device(torch::headeronly::DeviceType::CPU);
torch::stable::Device cuda_device(torch::headeronly::DeviceType::CUDA, 0);
Tensor Creation
Example:
auto tensor = torch::stable::empty(
{3, 4},
torch::headeronly::ScalarType::Float,
torch::headeronly::Layout::Strided,
torch::stable::Device(torch::headeronly::DeviceType::CUDA, 0),
false,
torch::headeronly::MemoryFormat::Contiguous);
Tensor Manipulation
Device and Type Conversion
In-place Operations
Mathematical Operations